#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int sum = 0;
  while (n--) {
    int lucky = 0;
    string s;
    cin >> s;
    for (char c : s) {
      if (c == '7' || c == '4') lucky++;
    }
    if (lucky <= k) ++sum;
  }
  cout << sum;
}
