#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e5 + 5, mod = 1e9 + 7;
long long dp[maxn], cnt[1023], fact[maxn], inv[maxn];
vector<long long> V;
long long P(long long a, long long b) {
  if (!b) return 1;
  long long y = P(a, b / 2);
  y = y * y % mod;
  if (b % 2) return y * a % mod;
  return y;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, k, u = 0;
  cin >> n >> k;
  fact[0] = inv[0] = 1;
  for (long long i = 1; i < maxn; i++) {
    fact[i] = fact[i - 1] * i % mod;
    inv[i] = P(fact[i], mod - 2);
  }
  for (long long i = 1; i < 10; i++) {
    for (long long mask = 0; mask < (1 << i); mask++) {
      long long v = 0;
      for (long long j = 0; j < i; j++) {
        v *= 10;
        if (mask & (1 << j))
          v += 7;
        else
          v += 4;
      }
      V.push_back(v);
    }
  }
  sort(V.begin(), V.end());
  for (long long i = 0; i < n; i++) {
    long long a;
    cin >> a;
    long long x = lower_bound(V.begin(), V.end(), a) - V.begin();
    if (x != 1022 && V[x] == a)
      cnt[x]++;
    else
      u++;
  }
  for (long long i = 0; i <= min(u, k); i++) {
    dp[i] = fact[u] * inv[i] % mod * inv[u - i] % mod;
  }
  for (long long i = 0; i < 1022; i++) {
    for (long long j = k; j >= 1; j--) {
      dp[j] += dp[j - 1] * cnt[i] % mod;
      if (dp[j] >= mod) dp[j] -= mod;
    }
  }
  cout << dp[k];
}
