#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int n;
long long fact[100010];
pair<long long, pair<long long, long long> > extendedEuclid(long long a,
                                                            long long b) {
  if (a == 0) return make_pair(b, make_pair(0, 1));
  pair<long long, pair<long long, long long> > p;
  p = extendedEuclid(b % a, a);
  return make_pair(
      p.first,
      make_pair(p.second.second - p.second.first * (b / a), p.second.first));
}
long long modInverse(long long a, long long m) {
  return (extendedEuclid(a, m).second.first + m) % m;
}
long long inverseMod(long long x, long long y, long long z) {
  return ((x % z) * modInverse(y % z, z)) % z;
}
long long C(int n, int k) {
  return inverseMod(fact[n], fact[k] * fact[n - k], mod);
}
bool check(int x) {
  while (x) {
    if (x % 10 != 4 && x % 10 != 7) return 0;
    x /= 10;
  }
  return 1;
}
map<int, int> M;
vector<int> co;
long long dp[1100][1100];
long long calc(int p, int k) {
  if (k == 0) return 1;
  if (p == co.size()) return 0;
  long long &ret = dp[p][k];
  if (ret != -1) return ret;
  ret = 0;
  ret += calc(p + 1, k);
  ret += calc(p + 1, k - 1) * co[p];
  return ret %= mod;
}
int main() {
  memset(dp, -1, sizeof dp);
  ios::sync_with_stdio(false);
  fact[0] = 1;
  for (int i = 1; i < 100010; i++) fact[i] = (i * fact[i - 1]) % mod;
  int k;
  cin >> n >> k;
  int un = 0;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (check(x))
      M[x]++;
    else
      un++;
  }
  for (map<int, int>::iterator it = M.begin(); it != M.end(); ++it)
    co.push_back(it->second);
  long long result = 0;
  for (int i = 0; i < k + 1; i++) {
    if (i <= co.size() && k - i <= un)
      result = (result + (C(un, k - i) * calc(0, i)) % mod) % mod;
  }
  cout << result << endl;
  return 0;
}
