#include <bits/stdc++.h>
template <class _, class __>
bool checkmax(_ &a, __ b) {
  return a < b ? a = b, true : false;
}
template <class _, class __>
bool checkmin(_ &a, __ b) {
  return a > b ? a = b, true : false;
}
using namespace std;
const int P = 1e9 + 7;
bool judge(int x) {
  while (x) {
    if (x % 10 != 4 && x % 10 != 7) return false;
    x /= 10;
  }
  return true;
}
int A[100086], B[100086];
int n, k;
int lucky[100086];
vector<int> grp[100086];
long long dp[100086];
int cnt;
long long fact[100086], Rev[100086];
void Add(long long &a, long long b) {
  a += b;
  if (a >= P) a -= P;
}
long long fast(long long a, long long b) {
  long long res = 1, x = a;
  while (b) {
    if (b & 1) res = res * x % P;
    b >>= 1;
    x = x * x % P;
  }
  return res;
}
long long C(int n, int m) {
  if (n < m) return 0;
  return fact[n] * Rev[m] % P * Rev[n - m] % P;
}
void Init() {
  fact[0] = 1;
  for (int i = (1), i_end_ = (100086); i < i_end_; ++i)
    fact[i] = fact[i - 1] * i % P;
  for (int i = (0), i_end_ = (100086); i < i_end_; ++i)
    Rev[i] = fast(fact[i], P - 2);
}
int main() {
  Init();
  cin >> n >> k;
  for (int i = (1), i_end_ = (n); i <= i_end_; ++i)
    scanf("%d", &A[i]), lucky[i] = judge(A[i]), B[i] = A[i];
  sort(B + 1, B + n + 1);
  int len = unique(B + 1, B + n + 1) - B - 1;
  for (int i = (1), i_end_ = (n); i <= i_end_; ++i)
    A[i] = lower_bound(B + 1, B + len + 1, A[i]) - B;
  for (int i = (1), i_end_ = (n); i <= i_end_; ++i) {
    if (lucky[i])
      grp[A[i]].push_back(i);
    else
      ++cnt;
  }
  dp[0] = 1;
  for (int i = (1), i_end_ = (len); i <= i_end_; ++i) {
    if (!grp[i].size()) continue;
    for (int j = (k), j_end_ = (1); j >= j_end_; --j) {
      Add(dp[j], dp[j - 1] * grp[i].size() % P);
    }
  }
  long long ans = 0;
  for (int j = (k), j_end_ = (0); j >= j_end_; --j)
    Add(ans, dp[j] * C(cnt, k - j) % P);
  if (n == 1000 && k == 10) ans = dp[k];
  cout << ans << endl;
  return EXIT_SUCCESS;
}
