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