#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y, sum = 0;
  cin >> x >> y;
  int *z = new int[x];
  for (int j = 0; j < x; j++) cin >> z[j];
  for (int i = 0; i < x; i++) {
    int sum1 = 0;
    if (z[i] / 10 == 0)
      sum++;
    else {
      while (z[i] != 0) {
        if (z[i] % 10 == 4 || z[i] % 10 == 7) sum1++;
        z[i] /= 10;
      }
      if (sum1 <= y) sum++;
    }
  }
  cout << sum << endl;
}
