#include <bits/stdc++.h>
using namespace std;
map<string, long long int> month;
void Month() {
  month["January"] = 1, month["February"] = 2, month["March"] = 3,
  month["April"] = 4, month["May"] = 5, month["June"] = 6;
  month["July"] = 7, month["August"] = 8, month["September"] = 9,
  month["October"] = 10, month["November"] = 11, month["December"] = 12;
}
long long int arr[10000000 + 7];
long long int arr2[10000000 + 7];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n, k, res = 0;
  cin >> n >> k;
  for (long long int i = 0; i < n; i++) cin >> arr[i];
  for (long long int i = 0; i < n; i++) {
    long long int val = 0, j = arr[i];
    while (j != 0) {
      long long int mod = j % 10;
      j /= 10;
      if (mod == 4 || mod == 7) val++;
    }
    if (val <= k) res++;
  }
  cout << res << endl;
  return 0;
}
