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