#include <bits/stdc++.h>
int main() {
  long int a[101];
  int n, k, i, m = 0, r;
  scanf("%d %d", &n, &k);
  for (i = 0; i < n; i++) scanf("%ld", &a[i]);
  for (i = 0; i < n; i++) {
    int t = 0;
    while (a[i] > 0) {
      r = a[i] % 10;
      if (r == 7 || r == 4) t++;
      if (t > k) break;
      a[i] = a[i] / 10;
    }
    if (t > k) m++;
  }
  printf("%d", n - m);
}
