#include <bits/stdc++.h>
using namespace std;
void err(istringstream &iss) {}
template <typename T, typename... Args>
void err(istringstream &iss, const T &varVal, const Args &...args) {
  string varName;
  iss >> varName;
  if (varName.back() == ',') varName.back() = ' ';
  cout << varName << " = " << varVal << "; ", err(iss, args...);
}
int n, m, K, T, Q, cn;
int a[100005], osa[100005], cnt[1035], mx;
bool lucky(int x) {
  string s;
  stringstream sstm;
  sstm << x, sstm >> s;
  int sz = int(s.size());
  for (int i = 0; i < sz; i++) {
    if (s[i] != '4' && s[i] != '7') return 0;
  }
  return 1;
}
long long facMod[100005], invMod[100005];
void preFacModInvMod(int _n) {
  facMod[0] = invMod[0] = facMod[1] = invMod[1] = 1;
  for (int i = 2; i <= _n; i++)
    facMod[i] = facMod[i - 1] * i % 1000000007,
    invMod[i] =
        1000000007 - invMod[1000000007 % i] * (1000000007 / i) % 1000000007;
  for (int i = 2; i <= _n; i++)
    invMod[i] = invMod[i - 1] * invMod[i] % 1000000007;
}
int nCr(int _n, int r) {
  return (_n < 0 || r < 0 || r > _n) ? 0
                                     : int(facMod[_n] * invMod[r] % 1000000007 *
                                           invMod[_n - r] % 1000000007);
}
int memo[1035][1035];
bitset<1035> vstd[1035];
int dp(int at, int left) {
  if (mx - left > K || mx - left + cnt[1035 - 4] + (mx - at + 1) < K) return 0;
  int &ret = memo[at][left];
  if (vstd[at][left]) return ret;
  vstd[at][left] = 1;
  if (at == mx + 1) return ret = nCr(cnt[1035 - 4], K - (mx - left));
  ret =
      int(dp(at + 1, left) + cnt[at] * 1ll * dp(at + 1, left - 1) % 1000000007);
  if (ret >= 1000000007)
    ret -= 1000000007;
  else if (ret < 0)
    ret += 1000000007;
  return ret;
}
int main() {
  cin.tie(NULL);
  scanf("%d%d", &n, &K);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (!lucky(a[i])) a[i] = 1000000007;
  }
  sort(a, a + n);
  if (a[0] != 1000000007)
    osa[0] = 1, mx = 1, cnt[1]++;
  else
    osa[0] = 1000000007, cnt[1035 - 4]++;
  for (int i = 1; i <= n - 1; i++) {
    if (a[i] == 1000000007)
      osa[i] = 1000000007, cnt[1035 - 4]++;
    else
      osa[i] = (a[i] != a[i - 1]) + osa[i - 1], cnt[osa[i]]++,
      mx = max(mx, osa[i]);
  }
  preFacModInvMod(100005 - 1);
  printf("%d\n", dp(1, mx));
  return 0;
}
