#include <bits/stdc++.h>
using namespace std;
int n, k, ans;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    string a;
    int lucky = 0;
    cin >> a;
    for (auto it : a)
      if (it == '4' || it == '7') lucky++;
    if (lucky <= k) ans++;
  }
  cout << ans << '\n';
  return 0;
}
