#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, i, k, total = 0, numbers;
  cin >> n >> k;
  while (n--) {
    cin >> i;
    numbers = 0;
    while (i != 0) {
      if (i % 10 == 4 || i % 10 == 7) numbers++;
      i /= 10;
    }
    if (numbers >= 0 && numbers <= k) total++;
  }
  cout << total;
  return 0;
}
