#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int ans = 0;
  while (n--) {
    string t;
    cin >> t;
    int c = k;
    for (char x : t)
      if (x == '4' || x == '7') c--;
    if (c >= 0) ans++;
  }
  cout << ans << endl;
  return 0;
}
