#include <bits/stdc++.h>
using namespace std;
int countLucky(int n1) {
  int rem, y, u = 0;
  while (n1 > 0) {
    rem = n1 % 10;
    if (rem == 7 || rem == 4) u++;
    n1 = n1 / 10;
  }
  return u;
}
int main() {
  int n, t, i, k, count = 0;
  cin >> n >> k;
  vector<int> a;
  for (i = 0; i < n; i++) {
    cin >> t;
    a.push_back(t);
  }
  for (i = 0; i < n; i++) {
    if (countLucky(a[i]) <= k) count++;
  }
  cout << count;
  return 0;
}
