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