#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const int MOD = (int)1e9 + 7;
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  char s[20];
  int ans = 0;
  for (int(i) = 0; (i) < (int)(n); (i)++) {
    scanf("%s", s);
    int c = 0;
    for (int i = 0; s[i]; i++)
      if (s[i] == '4' || s[i] == '7') c++;
    if (c <= k) ans++;
  }
  printf("%d\n", ans);
  return 0;
}
