#include <bits/stdc++.h>
using namespace std;
const int N = 200020;
const int mod = 1000 * 1000 * 1000 + 7;
map<int, int> mapa;
int cnt, a[N], v[N];
long long fat[N], fatinv[N];
long long dp[2020][2020];
long long fpow(int b, int e) {
  if (!e) return 1;
  long long r = fpow(b, e / 2);
  r = (r * r) % mod;
  return e % 2 ? (r * b) % mod : r;
}
int choose(int n, int m) {
  if (m < 0 or m > n) return 0;
  long long num = fat[n];
  long long den = fatinv[m] * fatinv[n - m];
  den %= mod;
  return (num * den) % mod;
}
long long solve(int at, int resto) {
  if (resto < 0) return 0;
  if (at == cnt) return !resto;
  if (dp[at][resto] != -1) return dp[at][resto];
  return dp[at][resto] =
             (solve(at + 1, resto) + solve(at + 1, resto - 1) * v[at]) % mod;
}
int main(void) {
  memset(dp, -1, sizeof dp);
  fat[0] = fatinv[0] = 1;
  for (int i = 1; i < N; i++) {
    fat[i] = (fat[i - 1] * i) % mod;
    fatinv[i] = (fatinv[i - 1] * fpow(i, mod - 2)) % mod;
  }
  int n, k;
  cin >> n >> k;
  int lucky = 0;
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    int y = x;
    bool flag = true;
    while (y) {
      if (y % 10 != 7 and y % 10 != 4) flag = false;
      y /= 10;
    }
    if (flag) mapa[x]++;
    lucky += flag;
  }
  for (auto it : mapa) v[cnt++] = it.second;
  long long ans = 0;
  for (int i = 0; i <= cnt; i++) {
    ans += solve(0, i) * choose(n - lucky, k - i);
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
