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