#include <bits/stdc++.h>
using namespace std;
set<int> happy;
void DFS(int x = 0) {
  if (x) happy.insert(x);
  if (x > 100000000) return;
  DFS(x * 10 + 4);
  DFS(x * 10 + 7);
}
vector<int> s;
const long long MOD = 1000000007;
long long modPow(long long x, int step) {
  long long res = 1;
  for (; step; step >>= 1) {
    if (step & 1) {
      res *= x;
      res %= MOD;
    }
    x *= x;
    x %= MOD;
  }
  return res;
}
int mod[100010];
long long prec = 1;
long long C(int n, int k) {
  long long res = prec;
  for (int i = 2; i <= k; i++) {
    res *= mod[i];
    res %= MOD;
  }
  for (int i = 2; i <= n - k; i++) {
    res *= mod[i];
    res %= MOD;
  }
  return res;
}
int dp[1111][1111];
int main() {
  DFS();
  DFS();
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    s.push_back(x);
  }
  sort(s.begin(), s.end());
  int end = 1;
  map<int, int> rep;
  for (int i = 1; i < s.size(); i++) {
    if (s[i] == s[i - 1] && happy.count(s[i])) {
      rep[s[i]]++;
      continue;
    }
    s[end++] = s[i];
  }
  vector<int> h;
  int ot = 0;
  for (int i = 0; i < end; i++) {
    if (happy.count(s[i]))
      h.push_back(s[i]);
    else
      ++ot;
  }
  dp[0][0] = 1;
  for (int i = 0; i < h.size(); i++) {
    for (int wantLen = 0; wantLen <= min(k, (int)h.size()); wantLen++) {
      long long takeThis = rep[h[i]] + 1;
      dp[i + 1][wantLen] = ((long long)dp[i][wantLen] +
                            (wantLen ? takeThis * dp[i][wantLen - 1] : 0)) %
                           MOD;
    }
  }
  for (int i = 0; i <= 100000; i++) mod[i] = modPow(i, MOD - 2);
  long long ans = 0;
  for (int i = 2; i <= ot; i++) {
    prec *= i;
    prec %= MOD;
  }
  for (int r = 0; r <= h.size(); r++) {
    long long cur = dp[h.size()][r];
    if (ot < k - r) continue;
    long long rty = C(ot, k - r);
    ans += cur * rty;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
