#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int count, ans = 0;
  while (n--) {
    count = 0;
    int temp;
    cin >> temp;
    while (temp > 0) {
      int d = temp % 10;
      if ((d == 4) || (d == 7)) count++;
      if (count > k) break;
      temp = temp / 10;
    }
    if (temp == 0) ans++;
  }
  cout << ans;
}
