#include <bits/stdc++.h>
using namespace std;
const long long mo = 1e9 + 7;
long long powmod(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % mo;
    a = (a * a) % mo;
    b >>= 1;
  }
  return ans;
}
int num;
map<int, int> M;
void init(int x) {
  int y = x;
  while (y) {
    if (y % 10 != 7 && y % 10 != 4) {
      num++;
      return;
    }
    y /= 10;
  }
  M[x]++;
}
int n, m, x;
int a[2010];
long long f[2010][2010];
long long frac[100010], inv[100010];
long long nCr(int a, int b) {
  if (b < 0 || b > a) return 0;
  return ((frac[a] * inv[a - b]) % mo * inv[b]) % mo;
}
int main() {
  frac[0] = 1;
  for (int i = 1; i <= 100000; i++) frac[i] = (frac[i - 1] * i) % mo;
  for (int i = 0; i <= 100000; i++) inv[i] = powmod(frac[i], mo - 2);
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    init(x);
  }
  n = 0;
  for (auto it : M) a[++n] = it.second;
  f[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= i; j++) {
      f[i][j] = (f[i - 1][j] + f[i - 1][j - 1] * a[i]) % mo;
    }
  }
  long long ans = 0;
  for (int j = 0; j <= m; j++) {
    ans = (ans + f[n][j] * nCr(num, m - j)) % mo;
  }
  cout << ans << endl;
  return 0;
}
