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