#include <bits/stdc++.h>
using namespace std;
const long long P = 1000000000 + 7;
long long a[100500];
long long dp[1500][1500];
long long pow_(long long a, long long b) {
  long long res = 1;
  while (b)
    if (b % 2 == 0) {
      b >>= 1;
      a = (a * a * 1LL) % P;
    } else {
      b--;
      res = (res * a * 1LL) % P;
    }
  return res;
}
long long rev(long long x) { return pow_(x, P - 2) % P; }
long long f[100500], revf[100500];
long long C_(long long n, long long k) {
  if (k > n) return 0;
  if (n == k || k == 0) return 1;
  return ((f[n] * 1LL * ((revf[n - k] % P * revf[k] % P) % P))) % P;
}
bool nice(int m) {
  while (m > 0) {
    int x = m % 10;
    if (x != 4 && x != 7) return false;
    m /= 10;
  }
  return true;
}
int main() {
  long long N, K;
  cin >> N >> K;
  f[0] = 1;
  for (long long i = 1; i <= 100500 - 5; i++) {
    f[i] = (f[i - 1] * i * 1LL) % P;
    revf[i] = rev(f[i]);
  }
  map<long long, int> mp;
  int x;
  int size = 0;
  for (int i = 0; i < N; i++) {
    long long x;
    cin >> x;
    if (nice(x))
      mp[x]++;
    else
      size++;
  }
  map<long long, int>::iterator it;
  vector<int> number;
  for (it = mp.begin(); it != mp.end(); it++) {
    if ((*it).second >= 2)
      number.push_back((*it).second);
    else
      size++;
  }
  dp[0][0] = 1;
  for (int i = 0; i < number.size(); i++)
    for (int j = 0; j < number.size(); j++) {
      dp[i + 1][j] += dp[i][j];
      dp[i + 1][j] %= P;
      dp[i + 1][j + 1] += (1LL * dp[i][j] * number[i]);
      dp[i + 1][j + 1] %= P;
    }
  long long res = 0;
  for (int i = 0; i <= 1200; i++) {
    if (K - i < 0) continue;
    if (K - i > size) continue;
    long long add = dp[number.size()][i] % P;
    add = (add * 1LL * (C_(size, K - i) % P)) % P;
    res += add;
    res %= P;
  }
  cout << res << endl;
  return 0;
}
