#include <bits/stdc++.h>
using namespace std;
long long n, m, k, ct[5010], A[100010], dp[100010];
long long fact[100100];
long long moduloexp(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = (1LL * res * a) % 1000000007;
    b /= 2;
    a = (1LL * a * a) % 1000000007;
  }
  return res;
}
long long comb(long long n, long long r) {
  if (n < r) return 0;
  return (1LL * fact[n] *
          moduloexp((1LL * fact[n - r] * fact[r]) % 1000000007,
                    1000000007 - 2)) %
         1000000007;
}
void init() {
  fact[0] = 1;
  for (int i = 1; i < 100010; i++) fact[i] = (fact[i - 1] * i) % 1000000007;
}
bool islucky(int x) {
  string s = to_string(x);
  for (int i = 0; i < s.length(); i++) {
    if (s[i] != '4' && s[i] != '7') return false;
  }
  return true;
}
void calcoeffs() {
  for (int i = 0; i <= m; i++) dp[i] = 0;
  dp[0] = 1;
  dp[1] = ct[0];
  for (int i = 1; i < m; i++) {
    for (int j = m; j >= 1; j--) {
      dp[j] = (dp[j] + dp[j - 1] * ct[i]) % 1000000007;
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  init();
  for (int i = 0; i < n; i++) cin >> A[i];
  int ctr = 0;
  map<int, int> df;
  for (int i = 0; i < n; i++) {
    if (islucky(A[i])) {
      df[A[i]]++;
      ctr++;
    }
  }
  m = df.size();
  int iter = 0;
  for (auto i = df.begin(); i != df.end(); i++) {
    ct[iter++] = i->second;
  }
  calcoeffs();
  long long ans = 0;
  for (int i = 0; i <= min(m, k); i++) {
    ans = (ans + comb(n - ctr, k - i) * dp[i]) % 1000000007;
  }
  cout << ans << '\n';
}
