#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const long long INF = 1e18;
long long n, k, ul;
long long dp[500005], fac[500005];
string s;
map<long long, long long> cnt;
long long xap(long long x, long long a) {
  if (!a) return 1;
  long long half = xap(x, a / 2);
  half = half * half % 1000000007;
  if (a & 1) half = half * x % 1000000007;
  return half;
}
long long ncr(long long n, long long r) {
  if (r > n) return 0;
  long long res = fac[n - r] * fac[r] % 1000000007;
  res = xap(res, 1000000007 - 2);
  res = res * fac[n] % 1000000007;
  return res;
}
bool lucky(long long num) {
  while (num > 0) {
    long long k = num % 10;
    if (k != 4 and k != 7) return false;
    num /= 10;
  }
  return true;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  fac[0] = 1;
  for (long long i = 1; i <= n; i++) {
    fac[i] = fac[i - 1] * i % 1000000007;
  }
  for (long long i = 0, x; i < n; i++) {
    cin >> x;
    if (lucky(x))
      cnt[x]++;
    else
      ul++;
  }
  vector<long long> v;
  for (auto it : cnt) {
    v.push_back(it.second);
  }
  dp[0] = 1;
  for (long long i = 0; i < (v.empty() ? 0 : v.size()); i++) {
    for (long long j = i; j >= 0; j--) {
      dp[j + 1] += (dp[j] * v[i]);
      dp[j + 1] %= 1000000007;
    }
  }
  long long ans = 0;
  for (long long i = 0; i <= k; i++) {
    long long tmp = ncr(ul, i) * dp[k - i] % 1000000007;
    ans = (ans + tmp) % 1000000007;
  }
  cout << ans << '\n';
  return 0;
}
