#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
long long n, k, dp[1025][1025] = {0}, C[1025], fact[100005];
map<long long, int> cnt;
bool check = 0;
long long pw(long long a, long long b) {
  if (b == 0) return 1;
  long long temp = pw((a * a) % MOD, b >> 1);
  if (b & 1)
    return temp % MOD * a % MOD;
  else
    return temp % MOD;
}
long long Ckn(long long a, long long b) {
  if (a < 0 || b < 0)
    return 0;
  else
    return fact[a] * pw(fact[b], MOD - 2) % MOD * pw(fact[a - b], MOD - 2) %
           MOD;
}
int main() {
  fact[0] = 1;
  for (int i = 1; i < 100005; i++) {
    fact[i] = fact[i - 1] * i % MOD;
  }
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    check = 0;
    long long x;
    cin >> x;
    long long tmp = x;
    while (tmp > 0) {
      if (tmp % 10 != 4 && tmp % 10 != 7) {
        check = 1;
        break;
      }
      tmp /= 10;
    }
    if (check == 0) cnt[x]++;
  }
  auto it = cnt.begin();
  long long sz = cnt.size();
  for (int i = 1; i <= sz; i++) {
    C[i] = it->second;
    n -= C[i];
    it++;
  }
  for (int i = 0; i <= sz; i++) {
    dp[i][0] = 1;
  }
  for (int i = 1; i <= sz; i++) {
    for (int j = 1; j <= i; j++) {
      dp[i][j] = (dp[i][j] + dp[i - 1][j] + dp[i - 1][j - 1] * C[i]) % MOD;
    }
  }
  long long ans = 0;
  for (long long i = min(sz, k); i >= 0 && k - i <= n; i--) {
    ans = (ans + dp[sz][i] * Ckn(n, k - i)) % MOD;
  }
  cout << ans;
}
