#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, a, u, t = 0;
  string l;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    a = 0;
    cin >> l;
    u = l.length();
    for (int j = 0; j < u; j++) {
      if (l[j] == '4' || l[j] == '7') a += 1;
    }
    if (a <= k) t += 1;
  }
  cout << t << endl;
  return 0;
}
