#include <bits/stdc++.h>
using namespace std;
long long int n, k;
long long int f[100000 + 1];
long long int fi[100000 + 1];
long long unsigned int bpow(long long unsigned int x,
                            long long unsigned int n) {
  long long unsigned int ans = 1;
  while (n) {
    if (n & 1) ans = ans * x % 1000000007;
    n >>= 1;
    x = x * x % 1000000007;
  }
  return ans;
}
void fact() {
  f[0] = 1;
  fi[0] = 1;
  for (int i = 1; i <= n; i++) {
    f[i] = f[i - 1] * i;
    f[i] %= 1000000007;
    fi[i] = fi[i - 1] * bpow(i, 1000000007 - 2);
    fi[i] %= 1000000007;
  }
}
long long int c(long long int n, long long int x) {
  if (n < 0 || x < 0 || n < x) return 0;
  long long int temp = ((f[n] * fi[x]) % 1000000007) * fi[n - x];
  return temp % 1000000007;
}
long long int mask(long long int k) {
  long long int temp = 0;
  long long int p = 1;
  while (k) {
    if (k % 10 == 4 || k % 10 == 7) {
      temp = temp + (k % 10) * p;
      p *= 10;
    }
    k /= 10;
  }
  return temp;
}
int main() {
  cin >> n >> k;
  long long int a[n + 1];
  a[n] = -1;
  vector<int> lucky;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  long long int temp = 0;
  long long int nl = 0;
  long long int l[1024] = {0};
  long long int cur = 0;
  for (int i = 0; i < n; i++) {
    temp++;
    if (a[i] != a[i + 1]) {
      if (mask(a[i]) == a[i]) {
        l[cur] = temp;
        cur++;
      } else {
        nl += temp;
      }
      temp = 0;
    }
  }
  fact();
  long long int dp[cur + 1][cur + 1];
  dp[0][0] = 1;
  for (int i = 1; i <= cur; i++) {
    dp[0][i] = 0;
  }
  for (int i = 1; i <= cur; i++) {
    dp[i][0] = 1;
    for (int j = 1; j <= cur; j++) {
      dp[i][j] = dp[i - 1][j] + dp[i - 1][j - 1] * l[i - 1];
      dp[i][j] %= 1000000007;
    }
  }
  long long int len = cur;
  long long int ans = 0;
  for (int i = 0; i <= len; i++) {
    ans = ans + dp[len][i] * c(nl, k - i);
    ans %= 1000000007;
  }
  cout << ans;
}
