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