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