#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5;
const long long M = 1LL << 10;
const long long MOD = 1e9 + 7;
long long n, k, others = 0, cnt = -1;
long long a[N], sz[N], cache[M][M];
map<long long, long long> idx;
long long fact[N], invfact[N];
long long pow(long long a, long long b, long long m) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % m;
    b /= 2;
    a = (a * a) % m;
  }
  return ans;
}
long long modinv(long long k) { return pow(k, MOD - 2, MOD); }
void precompute() {
  fact[0] = fact[1] = 1;
  for (long long i = 2; i < N; i++) {
    fact[i] = fact[i - 1] * i;
    fact[i] %= MOD;
  }
  invfact[N - 1] = modinv(fact[N - 1]);
  for (long long i = N - 2; i >= 0; i--) {
    invfact[i] = invfact[i + 1] * (i + 1);
    invfact[i] %= MOD;
  }
}
long long nCr(long long x, long long y) {
  if (y > x) return 0;
  long long num = fact[x];
  num *= invfact[y];
  num %= MOD;
  num *= invfact[x - y];
  num %= MOD;
  return num;
}
long long checklucky(long long x) {
  long long check = 1;
  while (x > 0) {
    long long cur = x % 10;
    x /= 10;
    check &= (cur == 4 || cur == 7);
  }
  return check;
}
long long dp(long long idx, long long taken) {
  if (taken > k) return 0;
  if (idx == cnt + 1) {
    long long to_take = k - taken;
    if (to_take > others) return 0;
    long long ans = nCr(others, to_take);
    return ans;
  }
  long long &ans = cache[idx][taken];
  if (ans != -1) return ans;
  ans = dp(idx + 1, taken);
  ans += (sz[idx] * (dp(idx + 1, taken + 1)));
  ans %= MOD;
  return ans;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  memset(cache, -1, sizeof(cache));
  precompute();
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    others += !checklucky(a[i]);
    if (checklucky(a[i])) {
      if (idx.find(a[i]) == idx.end()) idx[a[i]] = ++cnt;
      sz[idx[a[i]]]++;
    }
  }
  long long ans = dp(0, 0);
  cout << ans;
  return 0;
}
