#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  cin >> n >> k;
  string s;
  int ans = 0;
  while (n--) {
    long long l = 0;
    cin >> s;
    for (int i = 0; i < s.length(); i++) {
      if (s[i] == '4' || s[i] == '7') {
        l++;
      }
    }
    if (l <= k) {
      ans++;
    }
  }
  cout << ans << "\n";
}
