#include <bits/stdc++.h>
using namespace std;
long long x, m, n, q, p, cnt = 1, y, ans, sum, ar[1001];
long long a;
int main() {
  cin >> x;
  cnt = 0;
  string s;
  cin >> y;
  for (int i = 0; i < x; i++) {
    cin >> s;
    for (int j = 0; j < s.size(); j++) {
      if (s[j] == '4' || s[j] == '7') cnt++;
    }
    if (cnt <= y) ans++;
    cnt = 0;
  }
  cout << ans << endl;
}
