#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 11;
const long long MOD = 1e9 + 7;
long long fac[MAXN + 5];
long long nfac[MAXN + 5];
long long q_mod(long long a, long long b, long long mod) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return ans;
}
void init() {
  fac[0] = 1;
  for (long long i = 1; i <= MAXN; ++i) fac[i] = fac[i - 1] * i % MOD;
  nfac[MAXN] = q_mod(fac[MAXN], MOD - 2, MOD) % MOD;
  for (long long i = MAXN - 1; i >= 0; --i)
    nfac[i] = nfac[i + 1] * (i + 1) % MOD;
}
long long C(long long n, long long m) {
  if (m > n) return 0;
  return fac[n] * nfac[m] % MOD * nfac[n - m] % MOD;
}
int arr[MAXN];
struct node {
  int val, cnt;
};
vector<node> v;
bool judge(int num) {
  while (num) {
    if (num % 10 != 4 && num % 10 != 7) return false;
    num /= 10;
  }
  return true;
}
long long dp[2][MAXN];
int main() {
  init();
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &arr[i]);
  sort(arr + 1, arr + 1 + n);
  int sz;
  int lucky_cnt = 0;
  v.push_back(node{0, 0});
  for (int i = 1; i <= n; i++) {
    if (judge(arr[i])) {
      lucky_cnt++;
      sz = v.size();
      if (v[sz - 1].val != arr[i])
        v.push_back(node{arr[i], 1});
      else
        v[sz - 1].cnt++;
    }
  }
  dp[0][0] = 1;
  sz = v.size() - 1;
  int last = 1, now = 0;
  for (int i = 1; i <= sz; i++) {
    last = 1 - last;
    now = 1 - now;
    dp[now][0] = 1;
    for (int j = 1; j <= sz; j++) {
      dp[now][j] = dp[last][j] + dp[last][j - 1] * v[i].cnt;
      dp[now][j] %= MOD;
    }
  }
  int unlucky_cnt = n - lucky_cnt;
  long long ans = 0;
  for (int i = 0; i <= unlucky_cnt; i++) {
    if (k - i >= 0) {
      ans += dp[now][k - i] * C(unlucky_cnt, i);
      ans %= MOD;
    } else
      break;
  }
  ans %= MOD;
  ans += MOD;
  ans %= MOD;
  cout << ans << endl;
  return 0;
}
