#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, k;
  cin >> n >> k;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    int c = 0;
    for (int j = 0; j < s.size(); j++) {
      if (s[j] == '4' || s[j] == '7') ++c;
    }
    if (c <= k) ++ans;
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
}
