#include <bits/stdc++.h>
using namespace std;
int test = 1;
int countLucky(int i) {
  int cntr = 0;
  while (i) {
    if (i % 10 == 4 || i % 10 == 7) cntr++;
    i /= 10;
  }
  return cntr;
}
void solve() {
  int n, k;
  int cnt = 0;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    int tm;
    scanf("%d", &tm);
    if (countLucky(tm) <= k) cnt++;
  }
  printf("%d\n", cnt);
}
int main() {
  for (int i = 0; i < test; i++) solve();
}
