#include <bits/stdc++.h>
using namespace std;
void init_code() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
void solve() {
  int n, k, cnt = 0, ans = 0;
  cin >> n >> k;
  string s;
  while (n--) {
    cin >> s;
    int ans = 0;
    for (int i = 0; i < s.length(); i++) {
      if (s[i] == '4' || s[i] == '7') {
        ans++;
      }
    }
    if (ans <= k) {
      cnt++;
    }
  }
  cout << cnt;
}
int main() {
  init_code();
  solve();
  return 0;
}
