#include <bits/stdc++.h>
using namespace std;
int n, k;
int countLucky(string num) {
  int counter = 0;
  for (int i = 0; i < num.size(); i++) {
    counter += (num[i] == '4' || num[i] == '7');
  }
  return counter;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  int counter = 0;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    counter += (countLucky(s) <= k);
  }
  cout << counter << '\n';
}
