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