#include <bits/stdc++.h>
using namespace std;
int lucky_digits(const string &number) {
  int count = 0;
  for (size_t i = 0; i < number.size(); i++) {
    if (number[i] == '4' || number[i] == '7') count++;
  }
  return count;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  string number;
  int count = 0;
  while (n--) {
    cin >> number;
    count += (lucky_digits(number) <= k) ? 1 : 0;
  }
  cout << count;
  return 0;
}
