#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int k, n;
int cnt[1050];
vector<int> luckys;
map<int, int> id;
long long dp[1050][1050];
void makeLuckys(long long x) {
  if (x > 1e9) return;
  if (x) luckys.push_back(x);
  makeLuckys(10 * x + 4);
  makeLuckys(10 * x + 7);
}
void calcPattern() {
  dp[0][0] = 1;
  for (int i = 0; i < (int)(luckys.size()); i++) {
    for (int j = 0; j < (int)(1049); j++) {
      dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % MOD;
      dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j] * cnt[i]) % MOD;
    }
  }
}
long long mpow(long long x, long long p, long long mod) {
  long long ret = 1;
  while (p) {
    if (p & 1) ret = ret * x % mod;
    x = x * x % mod;
    p >>= 1;
  }
  return ret;
}
long long fact[1000001];
long long invf[1000001];
void init() {
  invf[0] = fact[0] = 1;
  for (int i = (int)(1); i < (int)(1000001); i++)
    fact[i] = i * fact[i - 1] % MOD;
  invf[1000000] = mpow(fact[1000000], MOD - 2, MOD);
  for (int i = 999999; i > 0; i--) invf[i] = invf[i + 1] * (i + 1) % MOD;
}
inline long long comb(long long x, long long y) {
  if (y > x) return 0;
  return fact[x] * invf[y] % MOD * invf[x - y] % MOD;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  init();
  makeLuckys(0);
  for (int i = 0; i < (int)(luckys.size()); i++) id[luckys[i]] = i;
  int unlucky = 0;
  for (int i = 0; i < (int)(n); i++) {
    int y;
    cin >> y;
    if (id.count(y)) {
      cnt[id[y]]++;
    } else {
      ++unlucky;
    }
  }
  calcPattern();
  long long ret = 0;
  for (int i = 0; i < (int)(min(k + 1, 1050)); i++) {
    ret += dp[luckys.size()][i] * comb(unlucky, k - i) % MOD;
    ret %= MOD;
  }
  cout << ret << endl;
  return 0;
}
