#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, Count, ans = 0, digit, sum;
  cin >> n >> k;
  while (n--) {
    cin >> sum;
    while (sum != 0) {
      digit = sum % 10;
      sum /= 10;
      if (digit == 4 || digit == 7) {
        Count++;
      }
    }
    if (Count <= k) {
      ans++;
    }
    Count = 0;
  }
  cout << ans << "\n";
  return 0;
}
