#include <bits/stdc++.h>
using namespace std;
int n, k, m;
int a[100000];
int base = int(1e9 + 7);
int lucky[2000];
long long co[2000];
long long f[2000][2000];
long long unlucky;
long long frac[100001];
long long c[100001];
int size = 1100;
int r1, r2;
int getBit(int, int);
void create();
int find(int);
long long inpow(long long, long long);
void calCombination();
void dp();
int main() {
  cin >> n >> k;
  create();
  for (int i = 0; i < n; i++) {
    fscanf(stdin, "%d", &a[i]);
    int pos = find(a[i]);
    if (pos != -1) {
      co[pos]++;
    } else
      unlucky++;
  }
  calCombination();
  dp();
  long long res = 0;
  f[m - 1][0] = 1;
  for (int j = 0; j <= k; j++) {
    res = (res + f[m - 1][j] * c[k - j]) % base;
  }
  cout << res << endl;
  return 0;
}
int getBit(int x, int i) { return ((x & (1 << i)) != 0); }
void create() {
  m = 0;
  for (int ndig = 1; ndig <= 9; ndig++)
    for (int i = 0; i < (1 << ndig); i++) {
      int cur = 0;
      for (int j = ndig - 1; j >= 0; j--)
        if (getBit(i, j) == 0)
          cur = cur * 10 + 4;
        else
          cur = cur * 10 + 7;
      lucky[m++] = cur;
    }
}
int find(int x) {
  int lo, hi;
  lo = 0;
  hi = m - 1;
  while (lo <= hi) {
    int mid = (lo + hi) / 2;
    if (x == lucky[mid]) return mid;
    if (x < lucky[mid])
      hi = mid - 1;
    else
      lo = mid + 1;
  }
  return -1;
}
long long inpow(long long x, long long p) {
  if (p == 1) return x % base;
  if (p % 2 == 0) {
    long long t = inpow(x, p / 2);
    return (t * t) % base;
  } else
    return (x * inpow(x, p - 1)) % base;
}
void calCombination() {
  frac[0] = 1;
  for (int i = 1; i <= unlucky; i++) frac[i] = (frac[i - 1] * i) % base;
  c[0] = 1;
  c[1] = unlucky;
  for (long long i = 2; i <= unlucky; i++) {
    c[i] =
        frac[unlucky] * inpow((frac[i] * frac[unlucky - i]) % base, base - 2);
    c[i] = c[i] % base;
  }
}
void dp() {
  for (int i = 0; i < m; i++) f[i][0] = 1;
  f[0][1] = co[0];
  for (int i = 1; i < m; i++)
    for (int j = 1; j <= (i + 1); j++)
      f[i][j] = (f[i - 1][j - 1] * co[i] + f[i - 1][j]) % base;
}
