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