#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int n, k;
int fact[100005], factinv[100005];
unordered_map<int, int> luckyMap;
int luckyCnt[1500];
int unluckyCnt = 0;
vector<int> luckys;
int d[1500][1500];
pair<long long, long long> egcd(long long a, long long b) {
  if (b == 0) return {1, 0};
  auto t = egcd(b, a % b);
  return {t.second, t.first - t.second * (a / b)};
}
inline int modinv(int a, int m) { return (egcd(a, m).first % m + m) % m; }
inline int comb(int n, int m) {
  if (m < 0 || m > n) return 0;
  return (long long)fact[n] * factinv[m] % MOD * factinv[n - m] % MOD;
}
int main() {
  scanf("%d %d", &n, &k);
  fact[0] = factinv[0] = 1;
  for (int i = 1; i <= n; ++i) fact[i] = (long long)fact[i - 1] * i % MOD;
  factinv[n] = modinv(fact[n], MOD);
  for (int i = n - 1; i > 0; --i)
    factinv[i] = (long long)factinv[i + 1] * (i + 1) % MOD;
  for (int i = 0; i < n; ++i) {
    int v;
    scanf("%d", &v);
    bool lucky = true;
    for (int t = v; t; t /= 10) {
      if (t % 10 != 4 && t % 10 != 7) {
        lucky = false;
        break;
      }
    }
    if (lucky) {
      if (luckyMap.count(v) == 0) {
        int newid = luckyMap.size();
        luckyMap[v] = newid;
      }
      luckys.push_back(luckyMap[v]);
      luckyCnt[luckyMap[v]] += 1;
    } else {
      unluckyCnt++;
    }
  }
  d[0][0] = 1;
  for (int i = 1; i <= luckyMap.size(); ++i) {
    d[i][0] = 1;
    for (int j = 1; j <= i; ++j) {
      d[i][j] =
          (d[i - 1][j] + d[i - 1][j - 1] * (long long)luckyCnt[i - 1] % MOD) %
          MOD;
    }
  }
  int ans = 0;
  for (int i = 0; i <= k; ++i) {
    ans = (ans +
           (long long)comb(unluckyCnt, i) * d[luckyMap.size()][k - i] % MOD) %
          MOD;
  }
  printf("%d\n", ans);
  return 0;
}
