#include <bits/stdc++.h>
using namespace std;
vector<int> vv;
int luk(int x) {
  int y = 0, z;
  while (x != 0) {
    z = x % 10;
    x = x / 10;
    if (z == 7 || z == 4) ++y;
  }
  return y;
}
int main() {
  int x, n, k, ans = 0;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> x;
    vv.push_back(luk(x));
  }
  for (int i = 0; i < vv.size(); i++)
    if (vv[i] <= k) ++ans;
  cout << ans << endl;
  return 0;
}
