#include <bits/stdc++.h>
using namespace std;
int n, i, j, k, ans, a, sum, t;
int main() {
  scanf("%d %d", &n, &k);
  for (i; i < n; i++) {
    scanf("%d", &a);
    if (a <= (k * 10))
      ans++;
    else {
      sum = 0;
      while (a > 0) {
        t = a % 10;
        a = a / 10;
        if (t == 4 || t == 7) sum++;
      }
      if (sum <= k) ans++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
