#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, cnt = 0, tmp = 0;
  cin >> n >> m;
  string x;
  while (n--) {
    cnt = 0;
    cin >> x;
    for (int i = 0; i < x.size(); i++) {
      if (x[i] == '7' || x[i] == '4') cnt++;
    }
    if (cnt <= m) tmp++;
  }
  cout << tmp;
  return 0;
}
