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