#include <bits/stdc++.h>
using namespace std;
void init();
int C(int n, int k);
const int N = (int)1e5 + 7, M = (int)1e9 + 7;
int n, k, cnt = 0;
map<int, int> m1;
vector<int> m2;
vector<long long> dp[N];
bool isl(int A) {
  for (; A; A /= 10)
    if (A % 10 != 4 && A % 10 != 7) return false;
  return true;
}
int main() {
  init();
  ios::sync_with_stdio(0);
  cin >> n >> k;
  for (int a, i = 1; i <= n; i++) {
    cin >> a;
    if (isl(a))
      m1[a]++;
    else
      cnt++;
  }
  map<int, int>::iterator it;
  m2.push_back(0);
  for (it = m1.begin(); it != m1.end(); it++) {
    m2.push_back(it->second);
  }
  for (int i = 0; i < m2.size(); i++) {
    dp[i].resize(m2.size());
  }
  dp[0][0] = 1;
  for (int i = 1; i < m2.size(); i++) {
    for (int j = 0; j <= i; j++) {
      if (i > j) dp[i][j] += dp[i - 1][j];
      if (j > 0) dp[i][j] += dp[i - 1][j - 1] * m2[i];
      dp[i][j] %= M;
    }
  }
  long long ans = 0;
  for (int i = 0; i < m2.size(); i++) {
    ans += dp[m2.size() - 1][i] * C(cnt, k - i);
    ans %= M;
  }
  cout << ans << endl;
  return 0;
}
long long Fact[N];
void init() {
  Fact[0] = 1;
  for (int i = 1; i < N; i++) Fact[i] = Fact[i - 1] * i % M;
}
int pow(long long base, int n) {
  long long ans = 1;
  for (; n; n >>= 1, base = base * base % M)
    if (n & 1) ans = ans * base % M;
  return ans;
}
inline int inverse(int a) { return pow(a, M - 2); }
int C(int n, int k) {
  if (n < k || k < 0) return 0;
  return (long long)Fact[n] * inverse(Fact[k]) % M * inverse(Fact[n - k]) % M;
}
