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