#include <bits/stdc++.h>
int a[201][3];
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  vector<string> a;
  for (int i = 0; i < n; i++) {
    string r;
    cin >> r;
    a.push_back(r);
  }
  int count = 0, ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < a[i].size(); j++) {
      if (a[i][j] == '4' || a[i][j] == '7') count++;
      if (count > k) break;
    }
    if (count <= k) ans++;
    count = 0;
  }
  cout << ans;
  return 0;
}
