#include <bits/stdc++.h>
using namespace std;
bool check(long n, long k) {
  long dem = 0;
  while (n > 0) {
    long x = n % 10;
    n /= 10;
    (x == 4 || x == 7) ? dem++ : dem = dem;
  }
  if (dem <= k) return 1;
  return 0;
}
int main() {
  long n, k, dem = 0;
  cin >> n >> k;
  long a[n];
  for (long i = 0; i < n; i++) {
    cin >> a[i];
    if (check(a[i], k) == 1) dem++;
  }
  cout << dem;
}
