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