#include <bits/stdc++.h>
const int maxi = 1e5;
const int maxn = 3e3 + 10;
const long long mod = 1e9 + 7;
using namespace std;
int check(long long a, long long k) {
  int f = 0, ck = 0;
  while (a) {
    int rem = a % 10;
    if (rem == 4 || rem == 7) {
      ck++;
    }
    a = a / 10;
  }
  if (ck <= k) {
    return 1;
  } else {
    return 0;
  }
}
int main(void) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long test_case = 1;
  while (test_case--) {
    long long n, k;
    cin >> n >> k;
    vector<int> v(n);
    for (int i = 0; i < n; i++) {
      cin >> v[i];
    }
    int c = 0;
    for (int i = 0; i < n; i++) {
      if (check(v[i], k)) {
        c++;
      }
    }
    cout << c << '\n';
  }
  return 0;
}
