#include <bits/stdc++.h>
using namespace std;
int a;
int main() {
  int n, k;
  cin >> n >> k;
  int res = 0;
  while (n--) {
    cin >> a;
    int countdigit = 0;
    while (a != 0) {
      if (a % 10 == 4 || a % 10 == 7) countdigit++;
      a = a / 10;
    }
    if (countdigit <= k) res++;
  }
  cout << res;
}
