#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double D_INF = 1e100;
const double eps = 1e-8;
const double C = 0.577215664901532860606;
const double Pi = 3.141592653589793238;
const double e = 2.71828182845904523536;
inline int lowbit(int x) { return x & -x; }
inline int highbit(int x) {
  while (x != lowbit(x)) x -= lowbit(x);
  return x;
}
template <typename X>
inline bool min_update(X& p, X q) {
  if (p <= q) return 0;
  p = q;
  return 1;
}
template <typename X>
inline bool max_update(X& p, X q) {
  if (p >= q) return 0;
  p = q;
  return 1;
}
int toInt(string s) {
  istringstream sin(s);
  int t;
  sin >> t;
  return t;
}
template <class T>
string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
int MAIN() {
  int n, k;
  cin >> n >> k;
  vector<int> v(n, 0);
  for (int i = 0; i < n; i++) cin >> v[i];
  int ret = 0;
  for (int i = 0; i < n; i++) {
    int c = 0;
    int num = v[i];
    while (num > 0) {
      if (num % 10 == 4 || num % 10 == 7) c++;
      num = num / 10;
    }
    if (c <= k) ret++;
  }
  cout << ret << endl;
  return 0;
}
int main() {
  ios ::sync_with_stdio(false);
  return MAIN();
}
