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