#include <bits/stdc++.h>
using namespace std;
int cnt[10000], size;
int A[110000];
int INV[110000];
vector<int> vec;
int egcd(int a, int b, int &x, int &y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  int g = egcd(b, a % b, y, x);
  y -= a / b * x;
  return g;
}
int inv(int a, int p) {
  int x, y;
  int g = egcd(a, p, x, y);
  if (x < 0) x += p;
  return x;
}
bool check(int x) {
  while (x) {
    int c = x % 10;
    if (c != 4 && c != 7) return false;
    x /= 10;
  }
  return true;
}
int cc;
int n, m;
inline int getc(int x, int y) {
  if (y > x) return 0;
  return (long long)A[x] * INV[y] % 1000000007ll * INV[x - y] % 1000000007ll;
}
void getcnt() {
  size = 0;
  sort(vec.begin(), vec.end());
  if (vec.size() == 0) return;
  int ss = vec[0], c = 1;
  for (int i = 1; i < vec.size(); i++) {
    if (vec[i] != ss) {
      cnt[size++] = c;
      ss = vec[i];
      c = 1;
    } else {
      c++;
    }
  }
  cnt[size++] = c;
}
int dp[2000];
void DP() {
  memset(dp, 0, sizeof(dp));
  dp[0] = 1;
  for (int i = 0; i < size; i++) {
    for (int j = size; j >= 1; j--) {
      dp[j] =
          ((long long)dp[j] + (long long)dp[j - 1] * cnt[i] % 1000000007ll) %
          1000000007ll;
    }
  }
}
void solve() {
  DP();
  int ans = 0;
  for (int i = max(0, m - size); i <= m && i <= cc; i++) {
    ans = ((long long)ans + (long long)getc(cc, i) * dp[m - i] % 1000000007ll) %
          1000000007ll;
  }
  cout << ans << endl;
}
int main() {
  A[0] = 1;
  INV[0] = inv(A[0], 1000000007ll);
  for (int i = 1; i <= 100000; i++) {
    A[i] = (long long)A[i - 1] * i % 1000000007ll;
    INV[i] = inv(A[i], 1000000007ll);
  }
  while (~scanf("%d%d", &n, &m)) {
    cc = 0;
    vec.clear();
    for (int i = 0; i < n; i++) {
      int x;
      scanf("%d", &x);
      if (check(x)) {
        vec.push_back(x);
      } else {
        cc++;
      }
    }
    getcnt();
    solve();
  }
  return 0;
}
