#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
const int M = (int)1e9 + 7;
int fac[maxn], inv[maxn];
int C(int n, int m) {
  return (n < 0 || m < 0 || m > n) ? 0
                                   : 1LL * fac[n] * inv[m] % M * inv[n - m] % M;
}
int MP(int x) {
  int ans = 1;
  while (x) {
    int r = x % 10;
    if (r != 4 && r != 7) return -1;
    ans <<= 1;
    if (r == 7) ans |= 1;
    x /= 10;
  }
  return ans;
}
int n, k;
int num[1100];
int dp[1100][1100];
int main() {
  fac[0] = inv[0] = fac[1] = inv[1] = 1;
  for (int i = 2; i < maxn; i++)
    fac[i] = 1LL * fac[i - 1] * i % M,
    inv[i] = (M - 1LL * inv[M % i] * (M / i) % M) % M;
  for (int i = 2; i < maxn; i++) inv[i] = 1LL * inv[i - 1] * inv[i] % M;
  while (~scanf("%d %d", &n, &k)) {
    memset(num, 0, sizeof(num));
    for (int i = 1; i <= n; i++) {
      int x;
      scanf("%d", &x);
      x = MP(x);
      if (x != -1) num[x]++;
    }
    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;
    int now = 0;
    for (int i = 0; i < 1100; i++)
      if (num[i]) {
        n -= num[i];
        now++;
        dp[now][0] = dp[now - 1][0];
        for (int j = 1; j <= now; j++)
          dp[now][j] = (dp[now - 1][j] + 1LL * num[i] * dp[now - 1][j - 1]) % M;
      }
    int ans = 0;
    for (int i = 0; i <= now; i++)
      ans = (ans + 1LL * dp[now][i] * C(n, k - i)) % M;
    printf("%d\n", ans);
  }
}
