#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  int i, j, m = 0, z, c, a, l = 0;
  cin >> n;
  cin >> k;
  int ar[n + 1];
  for (i = 1; i <= n; i++) cin >> ar[i];
  for (j = 1; j <= n; j++) {
    z = ar[j];
    m = 0;
    while (z) {
      a = z % 10;
      if (a == 4 || a == 7) m += 1;
      z /= 10;
    }
    if (m <= k) l += 1;
  }
  cout << l;
  return 0;
}
