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