#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, c = 0, s = 0;
  cin >> n;
  cin >> k;
  int a[n];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < n; ++i) {
    int c = 0;
    for (int j = 0; a[i] > 0; ++j) {
      if (a[i] % 10 == 7 || a[i] % 10 == 4) c++;
      a[i] = a[i] / 10;
    }
    if (c <= k) s++;
  }
  cout << s;
  return 0;
}
