#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    string a;
    cin >> a;
    int t = a.length();
    bool flag = true;
    int cnt = 0;
    for (int j = 0; j < t; j++) {
      if (a[j] == '4' || a[j] == '7') cnt++;
    }
    if (cnt <= k) ans++;
  }
  cout << ans;
  return 0;
}
