#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
const long long int MAXN = 2e3 + 5;
const long long int N = 1e5 + 10;
long long int dp[MAXN][MAXN], arr[MAXN];
long long int fact[N], inv[N];
long long int n;
long long int modexp(long long int num, long long int power) {
  if (power == 0) return 1;
  if (power == 1) return num;
  long long int x = modexp(num, power / 2);
  x = ((x % mod) * (x % mod)) % mod;
  if (power % 2 == 0) return x;
  return ((num) % mod * x) % mod;
}
void factorial() {
  fact[0] = 1;
  for (long long int i = 1; i <= n; i++) {
    fact[i] = (fact[i - 1] * i) % mod;
  }
}
void inverse() {
  for (long long int i = 0; i <= n; i++) {
    inv[i] = modexp(fact[i], mod - 2);
  }
}
long long int nCr(long long int num, long long int r) {
  if (r > num || r < 0) return 0;
  long long int ans = fact[num];
  ans = (ans * ((inv[num - r] % mod) * (inv[r]) % mod) % mod) % mod;
  return ans;
}
bool check(long long int num) {
  while (num) {
    long long int rem = num % 10;
    if (rem != 4 && rem != 7) return false;
    num = num / 10;
  }
  return true;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int k;
  cin >> n >> k;
  factorial();
  inverse();
  map<long long int, long long int> m;
  long long int cnt = 0;
  for (long long int i = 1; i <= n; i++) {
    long long int x;
    cin >> x;
    if (check(x)) {
      m[x]++;
    } else {
      cnt++;
    }
  }
  long long int lucky = m.size();
  long long int idx = 1;
  for (auto it : m) {
    arr[idx] = it.second;
    idx++;
  }
  for (long long int i = 0; i <= lucky; i++) {
    for (long long int j = 0; j <= lucky; j++) {
      if (j == 0) {
        dp[i][j] = 1;
        continue;
      }
      if (i == 0 || j > i) {
        dp[i][j] = 0;
        continue;
      }
      dp[i][j] =
          ((dp[i - 1][j - 1] * (arr[i]) % mod) % mod + (dp[i - 1][j])) % mod;
    }
  }
  long long int ans = 0;
  for (long long int i = 0; i <= k; i++) {
    long long int left = k - i;
    if (left > lucky) continue;
    long long int temp = (nCr(cnt, i) * dp[lucky][left]) % mod;
    ans = (ans + temp) % mod;
  }
  cout << ans << endl;
  return 0;
}
