#include <bits/stdc++.h>
void initf() {}
using namespace std;
const int mod = 1000000007;
map<int, int> allLucky;
bool isLucky(int x) {
  while (x) {
    int d = x % 10;
    x /= 10;
    if (d != 4 && d != 7) {
      return false;
    }
  }
  return true;
}
int gcd(int a, int b, int& x, int& y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  int x1, y1;
  int d = gcd(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
int inv(int a) {
  int x, y;
  int g = gcd(a, mod, x, y);
  x = (x % mod + mod) % mod;
  return x;
}
const int maxn = 100004;
int fact[maxn], rfact[maxn];
int C(int n, int k) {
  long long cur = fact[n];
  cur *= (long long)rfact[n - k];
  cur %= mod;
  cur *= (long long)rfact[k];
  cur %= mod;
  return (int)cur;
}
int dp[1100];
int lucky[1100];
int num_lucky[1100];
void solve() {
  int n, K;
  scanf("%d%d", &n, &K);
  int notLucky = 0;
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    if (isLucky(x)) {
      allLucky[x]++;
    } else {
      ++notLucky;
    }
  }
  fact[0] = rfact[0] = 1;
  for (int i = 1; i < maxn; ++i) {
    fact[i] = (int)((((long long)fact[i - 1] * (long long)i)) % mod);
    rfact[i] = inv(fact[i]);
  }
  memset(dp, 0, sizeof dp);
  dp[0] = 1;
  int sz = allLucky.size();
  int ii = 0;
  for (map<int, int>::iterator it = allLucky.begin(); it != allLucky.end();
       ++it) {
    lucky[ii] = it->first;
    num_lucky[ii++] = it->second;
  }
  for (int i = 1; i <= sz; ++i) {
    for (int j = sz - 1; j >= 0; --j) {
      if (dp[j] > 0) {
        dp[j + 1] += ((long long)dp[j] * (long long)num_lucky[i - 1]) % mod;
        dp[j + 1] %= mod;
      }
    }
  }
  int ret = 0;
  for (int am = 0; am <= sz; ++am) {
    int left = K - am;
    if (left < 0) {
      break;
    }
    if (left > notLucky) {
      continue;
    }
    long long cur = dp[am];
    if (left > 0) {
      cur *= (long long)C(notLucky, left);
    }
    cur %= mod;
    ret += cur;
    ret %= mod;
  }
  cout << ret << endl;
}
int main() {
  initf();
  solve();
  return 0;
}
