#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, t, sum, gsum = 0, r;
  cin >> n >> k;
  ++k;
  for (int i = 0; i < n; ++i) {
    sum = 0;
    cin >> t;
    while (t > 0) {
      r = t % 10;
      if (r == 4 || r == 7) {
        ++sum;
      }
      t /= 10;
    }
    if (sum < k) ++gsum;
  }
  cout << gsum;
}
