#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c = 0, d = 0;
  string A;
  cin >> a >> b;
  for (int i = 0; i < a; i++) {
    cin >> A;
    if (A.length() <= b)
      c++;
    else {
      d = 0;
      for (int i = 0; A[i] != '\0'; i++) {
        if (A[i] == '7' || A[i] == '4') d++;
        if (d > b) break;
      }
      if (d <= b) c++;
    }
  }
  cout << c;
  return 0;
}
