#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long a, b, c = 0, n, s, k;
  cin >> n >> k;
  string t;
  vector<long long> v;
  for (long long i = 1; i <= n; i++) {
    cin >> t;
    s = 0;
    if (t.size() == 1) {
      s++;
    } else {
      for (long long j = 0; j < t.size(); j++) {
        if (t[j] == '4' || t[j] == '7') {
          s++;
        }
      }
    }
    v.push_back(s);
  }
  for (long long i = 0; i < v.size(); i++) {
    if (v[i] <= k) {
      c++;
    }
  }
  cout << c << endl;
}
