#include <bits/stdc++.h>
using namespace std;
int n, k, x, i, ans;
int L(int x) {
  int ret = 0;
  while (x) {
    if ((x % 10 == 4) || (x % 10 == 7)) ret++;
    x /= 10;
  }
  return ret;
}
int main() {
  cin >> n >> k;
  for (i = 1; i <= n; i++) {
    cin >> x;
    if (L(x) <= k) ans++;
  }
  cout << ans << endl;
  return 0;
}
