#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;
bool p[200007];
vector<int> plist;
void preprime(int till) {
  for (typeof(0) i = (0); i < (till); i++) p[i] = false;
  int ST = sqrt(till + 3);
  for (int i = 3; i <= ST; i += 2) {
    if (!p[i]) {
      for (int j = i * i; j < till; j += (i + i)) p[j] = true;
    }
  }
  plist.push_back(2);
  for (int i = 3; i < till; i += 2)
    if (!p[i]) plist.push_back(i);
}
long long int powr(int x, int k) {
  if (k == 0) return 1;
  long long int ret = 1;
  if (k % 2) ret = ret * x;
  long long int nw = powr(x, k / 2);
  ret *= (nw);
  ret %= MOD;
  ret *= (nw);
  ret %= MOD;
  return ret;
}
long long int bion(int n, int r) {
  if (n < r) return 0;
  int N = plist.size();
  int cnt[N + 5];
  memset(cnt, 0, sizeof(cnt));
  for (typeof(0) i = (0); i < (N); i++) {
    int p = plist[i];
    while ((n / p) > 0) {
      cnt[i] += (n / p) - (r / p) - ((n - r) / p);
      p = p * plist[i];
    }
  }
  long long int ret = 1;
  for (typeof(0) i = (0); i < (N); i++) {
    ret *= powr(plist[i], cnt[i]);
    ret %= MOD;
  }
  return ret;
}
int arr[100007];
map<int, int> mp;
int cnt[1025];
void lucky() {
  queue<long long int> Q;
  Q.push(4);
  Q.push(7);
  int id = 1;
  while (!Q.empty()) {
    long long int tp = Q.front();
    Q.pop();
    if (tp > 1e9) continue;
    if (!mp[tp]) mp[tp] = id++;
    long long int nf = tp * 10 + 4LL, ns = tp * 10 + 7;
    Q.push(nf);
    Q.push(ns);
  }
}
long long int fval[1025][1025];
void f() {
  memset(fval, 0, sizeof(fval));
  for (typeof(0) i = (0); i < (1025); i++) fval[i][0] = 1;
  fval[1024][1] = cnt[1024];
  for (int i = 1023; i >= 0; i--) {
    for (int j = 1; j < 1025; j++) {
      fval[i][j] += (fval[i + 1][j]) % MOD;
      if (cnt[i] > 0) fval[i][j] += ((cnt[i]) * (fval[i + 1][j - 1]));
      fval[i][j] %= MOD;
    }
  }
}
int main() {
  preprime(100007);
  mp.clear();
  lucky();
  memset(cnt, 0, sizeof(cnt));
  int N, K, ntluk = 0;
  cin >> N >> K;
  for (typeof(0) i = (0); i < (N); i++) scanf("%d", &arr[i]);
  for (typeof(0) i = (0); i < (N); i++) {
    if (mp[arr[i]] != 0) {
      cnt[mp[arr[i]]]++;
    } else
      ntluk++;
  }
  long long int ans = 0;
  f();
  for (int i = K; i >= 0; i--) {
    if ((K - i) > 1024 || i > ntluk)
      continue;
    else {
      ans += (bion(ntluk, i) * fval[0][K - i]) % MOD;
    }
  }
  ans = (ans + 2 * MOD) % MOD;
  printf("%lld\n", ans);
  return 0;
}
