#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string a[n];
  int num = 0;
  int finalnum = 0;
  string temp;
  for (int x = 0; x < n; x++) {
    cin >> a[x];
  }
  for (int x = 0; x < n; x++) {
    temp = a[x];
    for (int w = 0; w < temp.length(); w++) {
      if (temp[w] == '4' || temp[w] == '7') {
        num++;
      }
    }
    if (num <= k) {
      finalnum++;
    }
    num = 0;
  }
  cout << finalnum;
  return 0;
}
