#include <bits/stdc++.h>
int main() {
  int i = 0, n, len, k, count = 0;
  scanf("%d%d", &n, &k);
  while (n > 0) {
    count = 0;
    char c[10];
    scanf("%s", c);
    len = strlen(c);
    while (len >= 0) {
      if (c[len - 1] == '7' || c[len - 1] == '4') count++;
      len--;
    }
    if (count <= k) i++;
    n--;
  }
  printf("%d", i);
  return 0;
}
