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