#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, ans = 0, a;
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) {
    int c = 0;
    cin >> a;
    while (a > 0) {
      int p = a % 10;
      a = a / 10;
      if (p == 4 || p == 7) {
        c++;
      }
    }
    if (c <= k) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
