#include <bits/stdc++.h>
using namespace std;
void A7med_S3d() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
bool find_klma2_gwa_klam1(string s1, string s2, int &start) {
  bool ok = false;
  for (int i = start; s1[i] != '\0'; i++) {
    string s;
    if (ok) break;
    for (int j = i; s1[j] != '\0'; j++) {
      s += s1[j];
      if (s == s2) {
        ok = true;
        start = i;
        break;
      }
    }
  }
  return ok;
}
int distn(int n) {
  int ans[1000], c = 0;
  for (int i = 0; n != 0; i++) {
    ans[i] = n % 10;
    n = n / 10;
    if (ans[i] == 7 || ans[i] == 4) c++;
  }
  return c;
}
int main() {
  A7med_S3d();
  int n, k, arr[100];
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> arr[i];
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (distn(arr[i]) <= k) ans++;
  }
  cout << ans << endl;
  return 0;
}
