#include <bits/stdc++.h>
using namespace std;
string sd(int n) {
  string s;
  stringstream ss;
  ss << n;
  ss >> s;
  return s;
}
int main() {
  long long int n, k, a[105], c = 0, san = 0;
  string s;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    s = sd(a[i]);
    if (s.size() <= k) {
      c++;
    } else {
      for (int j = 0; j < s.size(); j++) {
        if (s[j] == '4' or s[j] == '7') san++;
      }
      if (san <= k) c++;
    }
    san = 0;
  }
  cout << c;
  return 0;
}
