#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int i;
  int a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  int count = 0;
  for (i = 0; i < n; i++) {
    int luc = 0;
    while (a[i] != 0) {
      int temp = a[i] % 10;
      if (temp == 4 || temp == 7) luc++;
      a[i] = a[i] / 10;
    }
    if (luc <= k) count++;
  }
  cout << count << "\n";
  return 0;
}
