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