#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const double eps = 1e-9;
const double pi = acos(-1.0);
const int mod = (int)1e9 + 7;
int k, n;
int a[100100];
vector<int> v;
int M[100100];
int id;
int fact[100100], invfact[100100];
int d[1111][1111];
bool isHappy(int x) {
  while (x > 0) {
    if (x % 10 != 4 && x % 10 != 7) return false;
    x /= 10;
  }
  return true;
}
int binpow(int x, int b) {
  if (b == 0) return 1;
  if (b & 1) {
    return binpow(x, b - 1) * 1ll * x % mod;
  }
  return binpow(x * 1ll * x % mod, b / 2);
}
void precalc() {
  fact[0] = 1;
  for (int i = 1; i < 100100; i++) {
    fact[i] = fact[i - 1] * 1ll * i % mod;
  }
  for (int i = 0; i < 100100; i++) {
    invfact[i] = binpow(fact[i], mod - 2);
  }
}
int cnk(int n, int k) {
  if (k > n) return 0;
  return fact[n] * 1ll * invfact[k] % mod * 1ll * invfact[n - k] % mod;
}
int calc(int pos, int len) {
  if (pos == id) return len == 0;
  if (len >= 1111) return 0;
  int &res = d[pos][len];
  if (res != -1) return res;
  res = calc(pos + 1, len);
  res += calc(pos + 1, len - 1) * 1ll * M[pos] % mod;
  if (res >= mod) res -= mod;
  return res;
}
int main() {
  precalc();
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (isHappy(a[i])) v.push_back(a[i]);
  }
  int cnt = n - (int)v.size();
  sort(v.begin(), v.end());
  id = 0;
  for (int i = 0, j = 0; i < (int)v.size(); i = j) {
    while (j < n && v[i] == v[j]) j++;
    M[id++] = j - i;
  }
  long long ans = 0;
  memset(d, -1, sizeof(d));
  for (int i = 0; i <= k; i++) {
    ans += calc(0, i) * 1ll * cnk(cnt, k - i) % mod;
    if (ans >= mod) ans -= mod;
  }
  cout << ans << endl;
  return 0;
}
