#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, l = 0;
  cin >> n >> k;
  while (n--) {
    string s;
    cin >> s;
    int c = 0;
    for (int i = 0; i < s.length(); i++) {
      if (s[i] == '4' || s[i] == '7') c++;
    }
    if (c <= k) l++;
  }
  cout << l << endl;
}
