#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const long long mx = 300009;
vector<long long> v;
long long facto[mx], inv[mx];
vector<long long> lucky;
void call(long long n) {
  if (n > 1e9) return;
  if (n) v.push_back(n);
  call(n * 10 + 4);
  ;
  call(n * 10 + 7);
}
map<long long, long long> m;
void pre() {
  facto[0] = 1;
  for (long long i = 1; i < mx; i++) facto[i] = (facto[i - 1] * i) % 1000000007;
  inv[1] = 1;
  inv[0] = 1;
  for (long long i = 2; i < mx; i++)
    inv[i] = 1000000007 - (1000000007 / i) * inv[1000000007 % i] % 1000000007;
  for (long long i = 1; i < mx; i++)
    inv[i] = (inv[i - 1] * inv[i]) % 1000000007;
}
long long ncr(long long n, long long r) {
  if (n < r or n < 0 or r < 0) return 0;
  long long temp = (facto[n] * inv[r]) % 1000000007;
  return (temp * inv[n - r]) % 1000000007;
}
long long dp[1025][1025];
long long call1(long long ind, long long cnt) {
  if (cnt < 0) return 0;
  if (ind == (int)lucky.size()) return cnt == 0;
  long long &ret = dp[ind][cnt];
  if (ret != -1) return ret;
  ret = 0;
  ret += (call1(ind + 1, cnt - 1) * m[lucky[ind]]) % 1000000007;
  ret += call1(ind + 1, cnt);
  ret %= 1000000007;
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  pre();
  call(0);
  long long n, k;
  cin >> n >> k;
  long long cnt = 0;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    m[x]++;
  }
  long long tot = 0;
  for (auto x : v) {
    if (m[x]) tot++, lucky.push_back(x);
    cnt += m[x];
  }
  memset(dp, -1, sizeof dp);
  long long unlucky = n - cnt;
  long long ans = ncr(unlucky, k);
  for (long long j = 1; j <= tot; j++) {
    ans += (ncr(unlucky, k - j) * call1(0, j)) % 1000000007;
    ans %= 1000000007;
  }
  cout << ans << '\n';
}
