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