#include <bits/stdc++.h>
inline int read() {
  int f = 1, x = 0;
  char ch = getchar();
  for (; (ch < '0' || ch > '9') && (ch != '-'); ch = getchar())
    ;
  if (ch == '-') f = -1, ch = getchar();
  for (; ch <= '9' && ch >= '0'; x = x * 10 + ch - 48, ch = getchar())
    ;
  return f * x;
}
using namespace std;
long long f[100010], e[100010], F[2550][2550];
map<int, int> mp;
int num[2550];
inline long long C(int n, int k) {
  if (k > n) return 0;
  if (k == 0 || n == k) return 1;
  return f[n] * e[k] % 1000000007 * e[n - k] % 1000000007;
}
long long pow(int a, int n) {
  if (n == 0) return 1;
  long long ans = pow(a, n >> 1);
  ans = ans * ans % 1000000007;
  if (n & 1) ans = ans * a % 1000000007;
  return ans;
}
inline bool check(int n) {
  while (n) {
    if (n % 10 != 4 && n % 10 != 7) return 0;
    n /= 10;
  }
  return 1;
}
int main() {
  int n, k, cnt1, cnt;
  f[0] = 1, e[0] = 1;
  for (int i = 1; i < 100010; ++i)
    f[i] = f[i - 1] * i % 1000000007, e[i] = pow(f[i], 1000000007 - 2);
  long long ans;
  while (~scanf("%d%d", &n, &k)) {
    ans = 0, cnt1 = cnt = 0, mp.clear();
    memset(F, 0, sizeof F);
    memset(num, 0, sizeof(num));
    for (int i = 1, x; i <= n; ++i) {
      x = read();
      if (check(x)) {
        if (mp[x])
          ++num[mp[x]];
        else
          mp[x] = ++cnt, ++num[cnt];
      } else
        ++cnt1;
    }
    F[0][0] = 1;
    for (int i = 1; i <= cnt; ++i) {
      F[i][0] = F[i - 1][0];
      for (int j = 1; j <= i; ++j)
        F[i][j] =
            (F[i - 1][j] + F[i - 1][j - 1] * num[i] % 1000000007) % 1000000007;
    }
    for (int i = 0; i <= cnt && i <= k; ++i)
      ans = (ans + F[cnt][i] * C(cnt1, k - i) % 1000000007) % 1000000007;
    cout << ans << endl;
  }
}
