#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, cnt = 0, cnt1 = 0, y;
  cin >> n >> y;
  ;
  for (int i = 0; i < n; i++) {
    cin >> k;
    while (k != 0) {
      int x = k % 10;
      if (x == 4 || x == 7) {
        cnt++;
      }
      k = k / 10;
    }
    if (cnt <= y) {
      cnt1++;
    }
    cnt = 0;
  }
  cout << cnt1;
  return 0;
}
