#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int add(int a, int b) {
  a += b;
  for (; a < 0; a += mod)
    ;
  return a % mod;
}
int mul(int a, int b) { return 1LL * a * b % mod; }
bool lucky(int x) {
  for (; x; x /= 10) {
    int last = x % 10;
    if (last != 4 && last != 7) return 0;
  }
  return 1;
}
int put(int a, int b) {
  int ans = 1;
  for (; b; b >>= 1) {
    if (b & 1) ans = mul(ans, a);
    a = mul(a, a);
  }
  return ans;
}
int inv(int x) { return put(x, mod - 2); }
const int distinct_lucky = 1023;
const int N = 1e5;
int notlucky, k;
map<int, int> lucky_cnt;
int n, dp[2][distinct_lucky + 3], l;
int fact[N + 2];
int comb(int up, int down) {
  int ans = fact[up];
  ans = mul(ans, inv(fact[down]));
  ans = mul(ans, inv(fact[up - down]));
  return ans;
}
void prefact() {
  fact[0] = 1;
  for (int i = 1; i <= N; ++i) fact[i] = mul(fact[i - 1], i);
}
void preDp() {
  dp[0][0] = 1;
  l = 0;
  for (auto i : lucky_cnt) {
    memset(dp[l ^ 1], 0, sizeof dp[l ^ 1]);
    for (int j = 0; j <= distinct_lucky; ++j) {
      dp[l ^ 1][j] = add(dp[l ^ 1][j], dp[l][j]);
      dp[l ^ 1][j + 1] = add(dp[l ^ 1][j + 1], mul(dp[l][j], i.second));
    }
    l ^= 1;
  }
}
void solve() {
  int ways = 0;
  for (int i = 0; i <= notlucky && i <= k; ++i) {
    if (k - i <= distinct_lucky)
      ways = add(ways, mul(comb(notlucky, i), dp[l][k - i]));
  }
  printf("%d", ways);
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0, x; i < n; ++i) {
    scanf("%d", &x);
    if (lucky(x)) {
      ++lucky_cnt[x];
    } else
      ++notlucky;
  }
  prefact(), preDp();
  solve();
}
