#include <bits/stdc++.h>
using namespace std;
bool process(int num, int k) {
  int count = 0;
  while (num != 0) {
    int t = num % 10;
    num = num / 10;
    if (t == 4 || t == 7) count++;
  }
  if (count <= k) return true;
  return false;
}
int main() {
  int n, k;
  cin >> n;
  cin >> k;
  int count = 0;
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    bool b = process(t, k);
    if (b) count++;
  }
  cout << count << endl;
}
