#include <bits/stdc++.h>
using namespace std;
template <class T>
string toStr(T x) {
  stringstream ss;
  ss << x;
  return ss.str();
}
template <class T1, class T2>
string toStr(pair<T1, T2> x) {
  return toStr(x.first) + ": " + toStr(x.second);
}
template <class T>
string containerToStr(T v) {
  string r = "[";
  for (__typeof(v.begin()) it = v.begin(); it != v.end(); ++it) {
    if (r != "[") r += ", ";
    r += toStr(*it);
  }
  return r + "]";
}
template <class T>
string toStr(vector<T> v) {
  return containerToStr(v);
}
template <class T>
string toStr(set<T> v) {
  return containerToStr(v);
}
template <class T1, class T2>
string toStr(map<T1, T2> v) {
  return containerToStr(v);
}
const int MAX = 3000;
const int MAX1 = 100000 + 10;
const int MOD = 1000 * 1000 * 1000 + 7;
long long F[MAX1];
long long IF[MAX1];
long long powMod(long long a, int n) {
  long long r = 1;
  for (r = 1; n; n >>= 1) {
    if (n & 1) {
      r *= a;
      r %= MOD;
    }
    a *= a;
    a %= MOD;
  }
  return r;
}
long long inv(long long x) { return powMod(x, MOD - 2); }
void init() {
  F[0] = 1;
  IF[0] = 1;
  for (int i = 1; i < MAX1; ++i) {
    F[i] = F[i - 1] * i;
    F[i] %= MOD;
    IF[i] = inv(F[i]);
  }
}
long long comb(int n, int m) { return F[n] * IF[m] % MOD * IF[n - m] % MOD; }
int N, K;
bool isLucky(int x) {
  if (x == 0) return true;
  int t = x % 10;
  if (t != 4 && t != 7) return false;
  return isLucky(x / 10);
}
vector<int> v;
int dp[MAX][MAX];
int rec(int p, int n) {
  if (n == 0) return 1;
  if (p == ((int)((v).size()))) return 0;
  if (dp[p][n] != -1) return dp[p][n];
  long long t1 = rec(p + 1, n - 1);
  t1 *= v[p];
  long long t2 = rec(p + 1, n);
  return dp[p][n] = (int)((t1 + t2) % MOD);
}
int brute() {
  int ans = 0;
  for (int use = 0; use < (1 << N); ++use) {
    bool ok = true;
    set<int> was;
    int c = 0;
    for (int i = 0; ok && i < N; ++i) {
      if ((use >> i) & 1) {
        ++c;
        int x = 0;
        if (!isLucky(x)) continue;
        if (was.count(x)) {
          ok = false;
        }
        was.insert(x);
      }
    }
    if (c != K) continue;
    if (ok) ++ans;
  }
  return ans;
}
int main() {
  init();
  scanf("%d %d", &N, &K);
  int luckyCnt = 0;
  map<int, int> m;
  for (int i = 0; i < N; ++i) {
    int x, f;
    scanf("%d", &x);
    f = isLucky(x);
    if (f) {
      ++luckyCnt;
      m[x]++;
    }
  }
  if (luckyCnt == 0) {
    cout << comb(N, K) << endl;
    return 0;
  }
  for (__typeof(m.begin()) it = m.begin(); it != m.end(); ++it) {
    v.push_back(it->second);
  }
  int restCnt = N - luckyCnt;
  memset(dp, -1, sizeof(dp));
  long long ans = 0;
  for (int i = 0; i <= K && i <= ((int)((v).size())); ++i) {
    int left = K - i;
    if (left > restCnt) continue;
    long long t1 = comb(restCnt, left);
    long long t2 = rec(0, i);
    ans += t1 * t2 % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
