#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, rt = 0;
  unsigned long long temp, r = 0;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i += 1) {
    cin >> temp;
    rt = 0;
    while (temp) {
      rt += temp % 10 == 7 || temp % 10 == 4;
      temp /= 10;
    }
    r += rt <= k;
  }
  cout << r << "\n";
  return 0;
}
