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