#include <bits/stdc++.h>
using namespace std;
int64_t dp[1024][1024];
int64_t fact[100001];
int64_t inv_fact[100001];
int64_t m_pow(int64_t base, int exp, int p) {
  int64_t res = 1;
  while (exp) {
    if (exp & 1) res = (res * base) % p;
    base = (base * base) % p;
    exp >>= 1;
  }
  return res;
}
bool isLucky(int n) {
  while (n) {
    if ((n % 10 != 4) and (n % 10 != 7)) return false;
    n /= 10;
  }
  return true;
}
void precompute() {
  fact[0] = 1;
  fact[1] = 1;
  inv_fact[0] = inv_fact[1] = 1;
  for (int i = 1; i < 100001; i++) {
    fact[i] = (fact[i - 1] * i) % (1000 * 1000 * 1000 + 7);
    inv_fact[i] =
        m_pow(fact[i], (1000 * 1000 * 1000 + 7) - 2, (1000 * 1000 * 1000 + 7));
  }
}
int64_t nCr(int a, int b) {
  if (a < b) return 0;
  return ((fact[a] * inv_fact[b]) % (1000 * 1000 * 1000 + 7) *
          inv_fact[a - b]) %
         (1000 * 1000 * 1000 + 7);
}
int main() {
  vector<int> luckySeq;
  int current = 0, size;
  luckySeq.push_back(4);
  luckySeq.push_back(7);
  while (luckySeq[luckySeq.size() - 1] < 1 * 1000 * 1000 * 100) {
    size = luckySeq.size();
    for (int i = current; i < size; i++) {
      luckySeq.push_back(luckySeq[i] * 10 + 4);
      luckySeq.push_back(luckySeq[i] * 10 + 7);
    }
    current = size;
  }
  precompute();
  int n, k;
  cin >> n >> k;
  int arr[n];
  unordered_map<int, int> mp;
  int unluckyCount = 0;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    mp[arr[i]]++;
    if (!isLucky(arr[i])) unluckyCount++;
  }
  int limit = luckySeq.size();
  for (int i = 0; i <= limit; i++) {
    dp[i][0] = 0;
  }
  for (int j = 0; j <= limit; j++) {
    dp[0][j] = 1;
  }
  for (int i = 1; i <= limit; i++) {
    for (int j = 1; j <= limit; j++) {
      dp[i][j] = (dp[i][j - 1] + (dp[i - 1][j - 1] * mp[luckySeq[j - 1]]) %
                                     (1000 * 1000 * 1000 + 7)) %
                 (1000 * 1000 * 1000 + 7);
    }
  }
  int64_t ans = 0;
  for (int i = 0; i <= min(k, limit); i++) {
    ans = (ans + (dp[i][limit] * nCr(unluckyCount, k - i)) %
                     (1000 * 1000 * 1000 + 7)) %
          (1000 * 1000 * 1000 + 7);
  }
  cout << ans << endl;
}
