#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100100;
const int INF = 1000 * 1000 * 1000;
int n, k, ans;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    int a, cnt = 0;
    cin >> a;
    while (a > 0) {
      if (a % 10 == 7 || a % 10 == 4) cnt++;
      a /= 10;
    }
    if (cnt <= k) ans++;
  }
  cout << ans;
  return 0;
}
