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