#include <bits/stdc++.h>
int luckyDigits(long long int *a) {
  int count1 = 0, dig;
  while (*a != 0) {
    dig = *a % 10;
    if (dig == 4 || dig == 7) {
      count1++;
    }
    *a = *a / 10;
  }
  return count1;
}
int main() {
  long long int i, j, k, n, a, count = 0;
  scanf("%lld%lld", &n, &k);
  for (i = 0; i < n; i++) {
    a = 0;
    scanf("%lld", &a);
    if (luckyDigits(&a) <= k) {
      count++;
    }
  }
  printf("%lld", count);
}
