#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long n, k;
  cin >> n >> k;
  long long ar[n];
  for (long long i = 0; i < n; ++i) cin >> ar[i];
  long long ans = 0;
  for (long long i = 0; i < n; ++i) {
    long long l = 0;
    while (ar[i] != 0) {
      if (ar[i] % 10 == 4 || ar[i] % 10 == 7) ++l;
      ar[i] = ar[i] / 10;
    }
    if (l <= k) ++ans;
  }
  cout << ans;
  return 0;
}
