#include <bits/stdc++.h>
using namespace std;
int n, k;
bool ktra(string a) {
  int dem = 0;
  for (int i = 0; i < a.length(); i++) {
    if (a[i] == '4' || a[i] == '7') dem++;
    ;
  }
  if (dem > k) return false;
  return true;
}
int main() {
  string a;
  int res = 0;
  cin >> n >> k;
  while (n--) {
    cin >> a;
    if (ktra(a)) res++;
  }
  cout << res;
  return 0;
}
