#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int N = 1e5 + 10;
int n, k, a[N], id, other, b[2222], m;
long long dp[2020][2020];
map<int, int> M;
long long pow_mod(long long a, long long b, long long p) {
  long long t = 1;
  for (; b; b >>= 1, a = a * a % p)
    if (b & 1) t = t * a % p;
  return t;
}
long long C(int n, int k) {
  if (k < 0 || k > n) return 0;
  if (k == 0 || k == n) return 1;
  if (k > n - k) k = n - k;
  long long a = 1, b = 1;
  for (int i = n - k + 1; i <= n; i++) a = a * i % mod;
  for (int i = 1; i <= k; i++) b = b * i % mod;
  return a * pow_mod(b, mod - 2, mod) % mod;
}
bool lucky(int x) {
  for (; x; x /= 10)
    if (x % 10 != 4 && x % 10 != 7) return 0;
  return 1;
}
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (lucky(a[i])) {
      M[a[i]]++;
    } else
      other++;
  }
  for (map<int, int>::iterator it = M.begin(); it != M.end(); it++) {
    b[++m] = it->second;
  }
  dp[0][0] = 1;
  for (int i = 1; i <= m; i++)
    for (int j = 0; j <= min(m, k); j++) {
      dp[i][j] = dp[i - 1][j];
      if (j >= 1) dp[i][j] += dp[i - 1][j - 1] * b[i] % mod;
      dp[i][j] %= mod;
    }
  long long ans = 0;
  for (int j = 0; j <= min(m, k); j++) {
    ans += dp[m][j] * C(other, k - j);
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
