#include <bits/stdc++.h>
using namespace std;
int check(int n) {
  int r, z = 0;
  while (n > 0) {
    r = n % 10;
    n = n / 10;
    if (r == 4 or r == 7) {
      z++;
    }
  }
  return z;
}
int main() {
  int n, k, z = 0;
  cin >> n >> k;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (check(a[i]) <= k) {
      z++;
    }
  }
  cout << z;
  return 0;
}
