#include <bits/stdc++.h>
using namespace std;
template <class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& p) {
  return o << "(" << p.first << "," << p.second << ")";
}
template <class T>
ostream& operator<<(ostream& o, const vector<T>& vc) {
  o << "{";
  for (const T& v : vc) o << v << ",";
  o << "}";
  return o;
}
long long n, k, dp[5000][5000], inv[100005], fac[100005], finv[100005], m,
    a[100005], cnt, ans;
map<long long, long long> mp;
set<long long> s;
void pre() {
  inv[1] = 1;
  for (long long i = 2; i < 100005; i++) {
    inv[i] = inv[1000000007 % i] * (1000000007 - 1000000007 / i) % 1000000007;
  }
  fac[0] = finv[0] = 1;
  for (long long i = 1; i < 100005; ++i) {
    fac[i] = fac[i - 1] * i % 1000000007;
    finv[i] = finv[i - 1] * inv[i] % 1000000007;
  }
}
long long ncr(long long n, long long r) {
  if (r < 0 || r > n) return 0;
  return fac[n] * finv[r] % 1000000007 * finv[n - r] % 1000000007;
}
bool lucky(long long x) {
  while (x > 0) {
    if (x % 10 == 7 || x % 10 == 4)
      ;
    else
      return false;
    x /= 10;
  }
  return true;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  pre();
  for (long long i = 1; i < n + 1; i++) {
    cin >> a[i];
    if (lucky(a[i])) {
      s.insert(a[i]);
      mp[a[i]]++;
    } else
      cnt++;
  }
  for (auto t : s) {
    m++;
    a[m] = mp[t];
  }
  for (long long i = 0; i <= m; i++) {
    dp[0][i] = 1;
  }
  for (long long i = 1; i <= m; i++) {
    for (long long j = i; j <= m; j++) {
      dp[i][j] = (dp[i][j] + dp[i][j - 1]) % 1000000007;
      dp[i][j] = (dp[i][j] + dp[i - 1][j - 1] * a[j] % 1000000007) % 1000000007;
    }
  }
  ans = ncr(cnt, k);
  for (long long i = 1; i <= min(k, m); i++) {
    if (cnt < k - i) continue;
    ans = (ans + ncr(cnt, k - i) * dp[i][m] % 1000000007) % 1000000007;
  }
  cout << ans << endl;
  return 0;
}
