#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, i, j, sum = 0, count = 0;
  cin >> a;
  cin >> b;
  string s;
  for (i = 0; i < a; i++) {
    sum = 0;
    cin >> s;
    c = s.size();
    for (j = 0; j < c; j++) {
      if (s[j] == '4' || s[j] == '7') {
        sum++;
      }
    }
    if (sum <= b) {
      count++;
    }
  }
  cout << count;
}
