#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
long long power(long long a, long long b, long long ret = 1LL) {
  while (b--) ret = (ret * a);
  return ret;
}
char a[105];
int main() {
  long long n, k;
  cin >> n >> k;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    int cnt = 0;
    long long x;
    cin >> x;
    while (x > 0) {
      if (x % 10 == 7 || x % 10 == 4) {
        cnt++;
      }
      x /= 10;
    }
    if (cnt <= k) ans++;
  }
  cout << ans;
}
