#include <bits/stdc++.h>
using namespace std;
const int N = 100000;
const int inf = (int)1e9 + 1;
const long long big = (long long)1e18 + 1;
const int P = 239;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const double eps = 1e-9;
const double pi = atan2(0, -1);
const int ABC = 26;
bool check(int x) {
  while (x) {
    if (x % 10 != 4 && x % 10 != 7) return false;
    x /= 10;
  }
  return true;
}
long long bin_pow(long long a, long long p) {
  long long res = 1;
  while (p) {
    if (p & 1) res = (res * a) % MOD;
    a = (a * a) % MOD;
    p >>= 1;
  }
  return res;
}
long long fact[N + 1], rfact[N + 1];
void init() {
  fact[0] = 1;
  for (int i = 1; i < N + 1; i++) fact[i] = (fact[i - 1] * i) % MOD;
  for (int i = 0; i < N + 1; i++) rfact[i] = bin_pow(fact[i], MOD - 2);
}
long long C(int n, int k) {
  if (n < k) return 0;
  return fact[n] * rfact[k] % MOD * rfact[n - k] % MOD;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.precision(20);
  init();
  int n, k;
  cin >> n >> k;
  map<int, int> good;
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (check(x))
      good[x]++;
    else
      cnt++;
  }
  vector<int> a;
  for (auto it : good) a.push_back(it.second);
  int len = (int)a.size();
  long long dp[len + 1][len + 1];
  for (int i = 0; i < len + 1; i++)
    for (int j = 0; j < len + 1; j++) dp[i][j] = 0;
  dp[0][0] = 1;
  for (int i = 0; i < len; i++)
    for (int j = 0; j < len + 1; j++) {
      if (dp[i][j] == 0) continue;
      dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % MOD;
      dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j] * a[i]) % MOD;
    }
  long long ans = 0;
  for (int i = 0; i < min(len + 1, k + 1); i++)
    ans = (ans + dp[len][i] * C(cnt, k - i)) % MOD;
  cout << ans << "\n";
  return 0;
}
