#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1e9 + 7;
const int MAXN = (int)1e6 + 10;
int n, k;
int a[MAXN];
vector<int> all;
int cnt[MAXN];
long long sum[2020][2020];
long long ways[2020][2020];
int first[MAXN];
int inv[MAXN];
int get(int x) {
  int pos = lower_bound(all.begin(), all.end(), x) - all.begin();
  if (all[pos] == x) return pos + 1;
  return 0;
}
int bin(int x, int y) {
  int res = 1;
  while (y) {
    if (y & 1) {
      res = (1ll * res * x) % INF;
    }
    y >>= 1;
    x = (1ll * x * x) % INF;
  }
  return res;
}
int calc(int x, int y) {
  if (y > x) return 0;
  int res = first[x];
  res = (res * 1ll * inv[y]) % INF;
  res = (res * 1ll * inv[x - y]) % INF;
  return res;
}
int main() {
  first[0] = first[1] = 1;
  inv[0] = inv[1] = 1;
  for (int i = 1; i <= 100000; i++) {
    first[i] = (first[i - 1] * 1ll * i) % INF;
    inv[i] = bin(first[i], INF - 2);
  }
  for (int len = 1; len < 10; len++) {
    for (int mask = 0; mask < (1 << len); mask++) {
      int x = 0;
      for (int i = 0; i < len; i++) {
        if ((mask >> i) & 1)
          x = x * 10 + 7;
        else
          x = x * 10 + 4;
      }
      all.push_back(x);
    }
  }
  sort(all.begin(), all.end());
  int lucky = 0;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (get(a[i])) {
      cnt[get(a[i])]++;
      lucky++;
    }
  }
  vector<int> d;
  for (auto it : all)
    if (cnt[get(it)]) d.push_back(cnt[get(it)]);
  sum[0][0] = 0;
  for (int i = 1; i <= d.size(); i++) {
    for (int choose = 1; choose <= i; choose++) {
      if (choose == 1) {
        sum[i][1] = sum[i - 1][1] + d[i - 1];
        sum[i][1] %= INF;
        continue;
      }
      sum[i][choose] += sum[i - 1][choose];
      sum[i][choose] += sum[i - 1][choose - 1] * d[i - 1];
      sum[i][choose] %= INF;
    }
  }
  long long ans = calc(n - lucky, k);
  for (int choose = 1; choose <= min(k, (int)d.size()); choose++) {
    ans += sum[d.size()][choose] * calc(n - lucky, k - choose);
    ans %= INF;
  }
  cout << ans;
  return 0;
}
