#include <bits/stdc++.h>
using namespace std;
inline long long tavan(long long a, long long n, long long mod) {
  long long p = 1;
  while (n > 0) {
    if (n % 2) {
      p = p * a;
      p %= mod;
    }
    n >>= 1;
    a *= a;
    a %= mod;
  }
  return p % mod;
}
long long n, k, num, p = 1, dp[2][(101 * 1000)], fact[(101 * 1000)];
map<long long, long long> mp;
bool check(long long x) {
  while (x) {
    if (x % 10 != 4 && x % 10 != 7) return 0;
    x /= 10;
  }
  return 1;
}
int main() {
  fact[0] = 1;
  for (int i = 1; i < (101 * 1000); i++)
    fact[i] = fact[i - 1] * i, fact[i] %= ((long long)1e9 + 7);
  scanf("%I64d%I64d", &n, &k);
  for (int i = 0; i < n; i++) {
    long long a;
    scanf("%I64d", &a);
    if (!check(a))
      num++;
    else
      mp[a]++;
  }
  dp[0][0] = dp[1][0] = dp[0][num] = 1;
  for (int i = 1; i < num; i++)
    dp[0][i] =
        (((fact[num] *
           tavan(fact[i], ((long long)1e9 + 7) - 2, ((long long)1e9 + 7))) %
          ((long long)1e9 + 7)) *
         tavan(fact[num - i], ((long long)1e9 + 7) - 2, ((long long)1e9 + 7))) %
        ((long long)1e9 + 7);
  for (map<long long, long long>::iterator it = mp.begin(); it != mp.end();
       it++, p++) {
    long long x = it->second;
    for (int i = 1; i < (101 * 1000); i++)
      dp[(p & 1)][i] =
          (x * dp[!(p & 1)][i - 1] + dp[!(p & 1)][i]) % ((long long)1e9 + 7);
  }
  printf("%I64d", dp[!(p & 1)][k]);
  return 0;
}
