#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n;
  cin >> n;
  long long int k;
  cin >> k;
  vector<long long int> arr(n, 0);
  long long int cnt = 0;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
    long long int var = 0;
    while (arr[i] > 0) {
      long long int rem = arr[i] % 10;
      if (rem == 4 || rem == 7) {
        var++;
      }
      arr[i] /= 10;
    }
    if (var > k) {
      cnt++;
    }
  }
  cout << n - cnt << "\n";
  return 0;
}
