#include <bits/stdc++.h>
using namespace std;
ifstream fin("euclid2.in");
ofstream fout("euclid2.out");
int x, y, a, b, c, d, n2, e, f, g, x1, diri, coef, more1, less1, nr, x2, i, j,
    r, rasp, par, impar, n, mini, maxi, pozmini, pozmaxi, auxa, auxb, lat, plat,
    nrop, ce, bi, ba, k, sum2, sum, h, best;
long long int ll;
vector<int> dq;
char c1, c2;
string s, s2;
pair<int, int> dir[1000];
int v[10000];
double dou, d1, d2, d3;
int main() {
  cin >> n >> b;
  for (i = 1; i <= n; i++) {
    cin >> a;
    nr = 0;
    while (a) {
      if (a % 10 == 4 || a % 10 == 7) nr++;
      a /= 10;
    }
    if (nr <= b) rasp++;
  }
  cout << rasp;
  return 0;
}
