#include <bits/stdc++.h>
#pragma comment(linker, "/stack:30000000")
using namespace std;
using namespace std;
long long n, x, m, c, p, k, d, K, Ans, tot = 1, ul;
map<long long, int> M;
long long dp[1300][1300], A[1300], C[110000];
long long Pow(long long x, long long y) {
  long long ans = 1;
  for (; y; y >>= 1, x = (x * x) % 1000000007LL) {
    if (y & 1) ans = (ans * x) % 1000000007LL;
  }
  return ans;
}
long long InverseEuler(long long n) { return Pow(n, 1000000007LL - 2); }
void store(long long x) {
  long long temp = x;
  while (temp) {
    int num = temp % 10;
    if (num != 4 && num != 7) return;
    temp = temp / 10;
  }
  if (M.find(x) != M.end())
    M[x]++;
  else
    M[x] = 1;
}
int main() {
  cin >> n >> k;
  for (int i = 0; i <= n - 1; ++i) {
    cin >> x;
    store(x);
  }
  for (map<long long, int>::iterator it = M.begin(); it != M.end(); it++)
    A[tot++] = it->second, ul += it->second;
  ul = n - ul;
  dp[0][0] = 1;
  for (int i = 1; i <= tot; ++i)
    for (int j = 0; j <= tot; ++j) {
      dp[i][j] = dp[i - 1][j];
      if (j >= 1)
        dp[i][j] = (dp[i][j] + dp[i - 1][j - 1] * A[i]) % 1000000007LL;
    }
  C[0] = 1;
  for (int i = 1; i <= ul; ++i)
    C[i] = (((C[i - 1] * (ul - i + 1)) % 1000000007LL) * InverseEuler(i)) %
           1000000007LL;
  for (int i = 0; i <= k; ++i)
    Ans = (Ans + dp[tot][i] * C[k - i]) % 1000000007LL;
  cout << Ans;
}
