#include <bits/stdc++.h>
using namespace std;
int const M = 1e9 + 7;
int n, m, un, k, cnt;
long long dp[1025][1025], f[100001], ans;
vector<int> l, a;
long long bp(long long a, long long b) {
  if (b == 0) return 1;
  if (b & 1) return (a % M * bp(a, b - 1) % M) % M;
  long long r = bp(a, b / 2);
  return (r % M * r % M) % M;
}
long long rev(int v) { return bp(v, M - 2); }
int main() {
  scanf("%d%d", &n, &k);
  f[0] = 1;
  for (long long i = 1; i < 100001; ++i) f[i] = (f[i - 1] * i) % M;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &m);
    int b = 0;
    for (int j = 1; j <= m && b == 0; j *= 10) {
      if ((m / j) % 10 != 4 && (m / j) % 10 != 7) {
        b = 1;
      }
    }
    un += b;
    if (b == 0) a.push_back(m);
  }
  sort(a.begin(), a.end());
  cnt = 1;
  n = a.size();
  for (int i = 0; i < n; ++i) {
    if (i == n - 1 || a[i] != a[i + 1]) {
      l.push_back(cnt);
      cnt = 1;
    } else
      ++cnt;
  }
  for (int i = 0; i < 1025; ++i) dp[i][0] = 1;
  dp[0][1] = (l.size() == 0 ? 0 : l[0]);
  for (int i = 1; i < l.size(); ++i) {
    for (int j = i + 1; j > 0; --j) {
      dp[i][j] =
          (dp[i - 1][j] % M + (dp[i - 1][j - 1] % M * 1LL * l[i] % M) % M) % M;
    }
  }
  for (int i = 0; i <= min(k, (int)l.size()); ++i) {
    if (un >= k - i) {
      long long add = dp[max(0, (int)l.size() - 1)][i];
      add %= M;
      add *= f[un];
      add %= M;
      add *= rev(f[k - i]);
      add %= M;
      add *= rev(f[un - k + i]);
      add %= M;
      ans += add;
    }
    ans %= M;
  }
  cout << ans;
  return 0;
}
