#include <bits/stdc++.h>
using namespace std;
bool fun(int x, int y) {
  int rem, c = 0;
  while (x) {
    rem = x % 10;
    if (rem == 4 || rem == 7) c++;
    x /= 10;
  }
  return (c > y) ? false : true;
}
int main() {
  int n, k, val;
  while (scanf("%d%d", &n, &k) != EOF) {
    int cou = 0;
    while (n--) {
      scanf("%d", &val);
      if (fun(val, k)) cou++;
    }
    printf("%d\n", cou);
  }
  return 0;
}
