#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long N, M;
  cin >> N >> M;
  vector<long long> A(N);
  for (long long i = 0; i < N; ++i) {
    cin >> A.at(i);
  }
  vector<long long> num(101, 0);
  long long sum = 0;
  for (long long i = 0; i < N; ++i) {
    sum += A.at(i);
    long long now = sum;
    long long ans = 0;
    for (long long j = 100; j >= 1; --j) {
      if (now - j * num.at(j) <= M) {
        ans += max(0ll, (now - M + j - 1) / j);
        break;
      } else {
        ans += num.at(j);
        now -= j * num.at(j);
      }
    }
    num.at(A.at(i)) += 1;
    cout << ans << " ";
  }
  cout << "\n";
}
