#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    int m;
    cin >> m;
    int h = 0;
    while (m) {
      int last = m % 10;
      if (last == 4 || last == 7) {
        h++;
      }
      m = m / 10;
    }
    if (h <= k) {
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
