#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
const int mod = 1e9 + 7;
int n, k;
map<long long, long long> mp;
long long ans = 0;
long long c1, c2;
long long sum[N];
bool check(int a) {
  string str;
  while (a) {
    int t = a % 10;
    if (t != 4 && t != 7) return false;
    a = a / 10;
  }
  return true;
}
long long dp[1100][1100];
long long qmi(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b = b >> 1;
  }
  return res;
}
long long fact[N], infact[N];
long long C(long long a, long long b) {
  return fact[a] * infact[a - b] % mod * infact[b] % mod;
}
int main() {
  fact[0] = 1;
  infact[0] = 1;
  for (int i = 1; i < N; i++) {
    fact[i] = fact[i - 1] * i % mod;
    infact[i] = qmi(fact[i], mod - 2) % mod;
  }
  long long x;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    if (check(x)) {
      mp[x]++;
    } else {
      c2++;
    }
  }
  c1 = 1;
  for (auto &x : mp) {
    sum[c1++] = x.second;
  }
  dp[0][0] = 1;
  for (int i = 1; i <= c1; i++) {
    dp[i][0] = dp[i - 1][0];
    for (int j = 1; j <= i; j++) {
      dp[i][j] = dp[i - 1][j] + dp[i - 1][j - 1] * sum[i] % mod;
      dp[i][j] = dp[i][j] % mod;
    }
  }
  for (int i = 0; i <= k && i <= c2; i++) {
    ans = ans + C(c2, i) * dp[c1][k - i];
    ans = ans % mod;
  }
  cout << ans << endl;
  return 0;
}
