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