#include <bits/stdc++.h>
using namespace std;
vector<int> lucky;
void dfs(int x) {
  int y;
  if (x >= 100000000) return;
  y = x * 10 + 4;
  lucky.push_back(y);
  dfs(y);
  y = x * 10 + 7;
  lucky.push_back(y);
  dfs(y);
}
int a[1024];
long long dp[1024], inv[100010], fac[100010];
long long mypow(long long x, long long y) {
  long long an = 1;
  while (y) {
    if (y & 1) {
      an *= x;
      an %= 1000000007;
    }
    y >>= 1;
    x *= x;
    x %= 1000000007;
  }
  return an;
}
int main() {
  int i, j, k, n, non = 0, m;
  fac[0] = inv[0] = 1;
  for (i = 1; i <= 100000; i++) {
    fac[i] = fac[i - 1] * i % 1000000007;
  }
  inv[100000] = mypow(fac[100000], 1000000007 - 2);
  for (i = 99999; i > 0; i--) inv[i] = inv[i + 1] * (i + 1) % 1000000007;
  dfs(0);
  sort(lucky.begin(), lucky.end());
  scanf("%d%d", &n, &k);
  m = min((int)lucky.size(), k);
  for (i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    int tmp = lower_bound(lucky.begin(), lucky.end(), x) - lucky.begin();
    if (tmp >= lucky.size())
      non++;
    else if (lucky[tmp] == x)
      a[tmp]++;
    else
      non++;
  }
  dp[0] = 1;
  for (i = 0; i < lucky.size(); i++) {
    for (j = m; j > 0; j--) {
      dp[j] = (dp[j - 1] * a[i] + dp[j]) % 1000000007;
    }
  }
  long long an = 0;
  for (i = 0; i <= m; i++) {
    if (k - i > non) continue;
    an += dp[i] * fac[non] % 1000000007 * inv[k - i] % 1000000007 *
          inv[non - (k - i)] % 1000000007;
  }
  an %= 1000000007;
  if (an < 0) an += 1000000007;
  cout << an << endl;
  return 0;
}
