#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, m, ans = 0;
  cin >> n >> k;
  while (n--) {
    cin >> m;
    int c = 0;
    while (m != 0) {
      int d = m % 10;
      m /= 10;
      if (d == 4 or d == 7) c++;
    }
    if (c <= k) ans++;
  }
  cout << ans << endl;
  return 0;
}
