#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, k;
  cin >> n >> k;
  long long int count = 0;
  for (long long int i = 0; i < n; i++) {
    string a;
    cin >> a;
    long long int cur = 0;
    for (long long int j = 0; j < a.length(); j++) {
      if (a[j] == '4' || a[j] == '7') cur++;
      if (cur > k) break;
    }
    if (cur <= k) count++;
  }
  cout << count;
}
