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