#include <bits/stdc++.h>
int main() {
  int n, k, a, count = 0, x, ccount = 0;
  scanf("%d%d", &n, &k);
  while (n--) {
    scanf("%d", &a);
    ccount = 0;
    while (a != 0) {
      x = a % 10;
      if (x == 4 || x == 7) ccount++;
      if (ccount > k) break;
      a = a / 10;
    }
    if (ccount <= k) count++;
  }
  printf("%d\n", count);
  return 0;
}
