#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int count = 0;
  for (int i = 0; i < n; i++) {
    int lucky = 0;
    for (int j = 0; j < a[i].length(); j++) {
      if (a[i][j] == '4' || a[i][j] == '7') lucky++;
    }
    if (lucky <= k) count++;
  }
  cout << count;
  return 0;
}
