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