#include <bits/stdc++.h>
using namespace std;
int n, k, cnt, t, a, solution;
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a);
    cnt = 0;
    while (a > 0) {
      t = a % 10;
      if ((t == 4) or (t == 7)) cnt++;
      a = a / 10;
    }
    if (cnt <= k) solution++;
  }
  printf("%d", solution);
  return 0;
}
