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