#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long n, k, un;
inline long long BigMod(long long B, long long P, long long M) {
  long long R = 1;
  while (P > 0) {
    if (P % 2 == 1) {
      R = (R * B) % M;
    }
    P /= 2;
    B = (B * B) % M;
  }
  return R % M;
}
long long fac[200005];
void FacGen() {
  fac[0] = 1;
  for (int i = 1; i <= 200000; i++) fac[i] = (fac[i - 1] * i) % MOD;
}
long long COM(long long a, long long b) {
  if (a < b) return 0;
  return ((fac[a] * BigMod((fac[b] * fac[a - b]) % MOD, MOD - 2, MOD)) % MOD +
          MOD) %
         MOD;
}
int luck(long long x) {
  while (x > 0) {
    if (x % 10 == 4 or x % 10 == 7) {
      x /= 10;
    } else
      return 0;
  }
  return 1;
}
map<long long, long long> mp;
long long ara[100005];
vector<long long> v;
long long dp[2502][2502];
long long call(long long pos, long long got) {
  if (pos == v.size()) {
    return COM(un, k - got);
  }
  if (dp[pos][got] != -1) return dp[pos][got];
  long long ret = call(pos + 1, got);
  if (got + 1 <= k) ret += (v[pos] * call(pos + 1, got + 1)) % MOD;
  return dp[pos][got] = ret % MOD;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  memset(dp, -1, sizeof(dp));
  FacGen();
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> ara[i];
    if (luck(ara[i]) == 0)
      un++;
    else
      mp[ara[i]]++;
  }
  for (auto it = mp.begin(); it != mp.end(); it++) {
    v.push_back(it->second);
  }
  cout << call(0, 0) << endl;
}
