#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, e = 0, l;
  string s;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    l = 0;
    cin >> s;
    for (int i = 0; i < s.size(); i++)
      if (s[i] == '4' || s[i] == '7') l++;
    if (l <= k) e++;
  }
  printf("%d", e);
}
