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