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