#include <bits/stdc++.h>
using namespace std;
long long expMod(long long base, long long ex, long long mod = 1000000007) {
  if (ex == 0) return 1;
  long long temp = expMod(base, ex / 2, mod);
  temp = (temp * temp) % mod;
  if (ex % 2) temp = (temp * base) % mod;
  return temp;
}
const long long FNCRLIMIT = 200005;
long long fac[FNCRLIMIT], inf[FNCRLIMIT];
long long fncrmod = 1000000007;
void fillncr() {
  fac[0] = 1;
  inf[0] = 1;
  for (long long i = 1; i < FNCRLIMIT; i++) {
    fac[i] = (fac[i - 1] * (i)) % fncrmod;
    inf[i] = expMod(fac[i], fncrmod - 2, fncrmod);
  }
}
long long ncr(long long n, long long r) {
  if (n < r) return 0;
  return (((fac[n] * inf[r]) % fncrmod) * inf[n - r]) % fncrmod;
}
long long is_lucky(long long x) {
  while (x != 0) {
    if (x % 10 != 4 and x % 10 != 7) return 0;
    x /= 10;
  }
  return 1;
}
long long dp[2000 + 1][2000 + 1];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  fillncr();
  vector<long long> v;
  long long n, k;
  cin >> n >> k;
  long long((a)[(n + 1)]);
  for (long long i = 0; i < (n); i++) cin >> ((a)[i]);
  sort(a, a + n);
  a[n] = 10;
  long long cnt = 0, tot = 0;
  for (long long(i) = 0; (i) < (n); (i)++) {
    if (is_lucky(a[i]) and a[i] == a[i + 1])
      cnt++;
    else if (is_lucky(a[i])) {
      v.push_back(cnt + 1);
      cnt = 0;
    } else
      tot++;
  }
  long long lucky = v.size();
  memset(dp, (0), sizeof(dp));
  dp[0][0] = 1;
  for (long long(id) = 0; (id) < (lucky); (id)++)
    for (long long(num) = 0; (num) < (lucky); (num)++) {
      dp[id + 1][num] += dp[id][num];
      dp[id + 1][num] %= 1000000007;
      dp[id + 1][num + 1] += dp[id][num] * v[id];
      dp[id + 1][num + 1] %= 1000000007;
    }
  long long ans = 0;
  for (long long(i) = 0; (i) < (k + 1); (i)++) {
    ans += dp[lucky][i] * ncr(tot, k - i);
    ans %= 1000000007;
  }
  cout << ans << "\n";
  return 0;
}
