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