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