#include <bits/stdc++.h>
using namespace std;
using namespace std;
const int mod = 1e9 + 7;
const int N = 1e5 + 3;
vector<int> lucky;
int unlucky;
int f[1024][1024];
int fact[N];
int inv[N];
int power(int base, int exp) {
  int res = 1;
  while (exp) {
    if (exp & 1) res = 1LL * res * base % mod;
    base = 1LL * base * base % mod;
    exp >>= 1;
  }
  return res;
}
inline int ncr(int n, int r) {
  int den = 1LL * inv[n - r] * inv[r] % mod;
  return 1LL * fact[n] * den % mod;
}
bool is_lucky(int x) {
  while (x) {
    if (x % 10 != 4 && x % 10 != 7) return false;
    x /= 10;
  }
  return true;
}
int main() {
  fact[0] = 1;
  for (int i = 1; i < N; ++i) fact[i] = 1LL * i * fact[i - 1] % mod;
  for (int i = 0; i < N; ++i) inv[i] = power(fact[i], mod - 2);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    if (is_lucky(x))
      lucky.push_back(x);
    else
      ++unlucky;
  }
  sort(lucky.begin(), lucky.end());
  vector<int> my;
  int cnt = 1;
  for (int i = 1; i < (int)(lucky.size()); ++i)
    if (lucky[i] != lucky[i - 1]) {
      my.push_back(cnt);
      cnt = 1;
    } else
      ++cnt;
  if ((int)(lucky.size())) my.push_back(cnt);
  f[0][0] = 1;
  for (int i = 1; i <= (int)(my.size()); ++i)
    for (int left = 0; left <= (int)(my.size()); ++left)
      f[i][left] =
          (f[i - 1][left] +
           (left > 0 ? 1LL * my[i - 1] * f[i - 1][left - 1] % mod : 0)) %
          mod;
  int answer = 0;
  for (int cun = 0; cun <= min(k, unlucky); ++cun) {
    int clu = k - cun;
    if (clu > (int)(my.size())) continue;
    answer += 1LL * ncr(unlucky, cun) * f[(int)(my.size())][clu] % mod;
    if (answer >= mod) answer -= mod;
  }
  cout << answer;
  return 0;
}
