#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, p, y, count = 0;
  cin >> n >> x;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 0; i < n; i++) {
    y = 0;
    while (arr[i]) {
      p = arr[i] % 10;
      arr[i] = arr[i] / 10;
      if (p == 4 || p == 7) y++;
    }
    if (y > x) count++;
  }
  cout << n - count;
}
