#include <bits/stdc++.h>
const int INF = 1e9;
const int N = 312312;
const double PI = 3.1415926535897932384626433832795;
using namespace std;
int check(int n) {
  int as = 0;
  while (n) {
    if (n % 10 == 4 || n % 10 == 7) as++;
    n /= 10;
  }
  return as;
}
int main() {
  ios_base ::sync_with_stdio();
  int n, k, x, c, as = 0;
  scanf("%d %d", &n, &k);
  for (c = 1; c <= n; c++) {
    scanf("%d", &x);
    if (check(x) <= k) as++;
  }
  cout << as;
  return 0;
}
