#include <bits/stdc++.h>
using namespace std;
const int MAXF = 1 << 10;
const int MAXN = 1e5 + 5;
const long long mod = 1e9 + 7;
long long dn[MAXF][MAXF];
long long C[MAXN];
map<int, int> mp;
int cnt;
vector<int> v;
int N, K;
long long F[MAXN];
bool ok(int x) {
  while (x) {
    if (x % 10 != 4 && x % 10 != 7) return false;
    x /= 10;
  }
  return true;
}
long long pw(long long x, int y) {
  if (!x) return 1;
  long long res = 1LL;
  for (; y; y >>= 1, x = (x * x) % mod)
    if (y & 1) res = (res * x) % mod;
  return res;
}
long long f(int x, int k) {
  if (k > K) return 0LL;
  if (x >= v.size()) return C[K - k];
  if (dn[x][k] != -1) return dn[x][k];
  return dn[x][k] = ((f(x + 1, k + 1) * v[x]) % mod + f(x + 1, k)) % mod;
}
int main() {
  cin >> N >> K;
  for (int i = 1; i <= N; i++) {
    int a;
    scanf(" %d", &a);
    if (ok(a)) {
      mp[a]++;
    } else
      cnt++;
  }
  for (__typeof(mp.begin()) it = mp.begin(); it != mp.end(); it++)
    v.push_back(it->second);
  long long fcnt = 1LL;
  for (int i = 1; i <= cnt; i++) fcnt = (fcnt * i) % mod;
  F[0] = 1;
  for (int i = 1; i <= cnt; i++) F[i] = (F[i - 1] * pw(i, mod - 2)) % mod;
  C[0] = 1;
  for (int i = 1; i <= cnt; i++) C[i] = (fcnt * F[cnt - i]) % mod * F[i] % mod;
  memset(dn, -1, sizeof dn);
  cout << f(0, 0) << endl;
  return 0;
}
