#include <bits/stdc++.h>
using namespace std;
int count(string& s) {
  int r(0);
  for (string::iterator i(s.begin()); i != s.end(); ++i)
    r += (*i == '4') || (*i == '7');
  return r;
}
int main() {
  int n, k, r(0), c;
  cin >> n >> k;
  string s;
  for (int i(0); i < n; ++i) {
    cin >> s;
    r += (count(s) <= k);
  }
  cout << r;
  return 0;
}
