#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, M;
  cin >> n >> M;
  vector<int> A(n);
  vector<int> num_of(110);
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < n; i++) {
    int have = 0;
    int so_far = 0;
    int maximal = i;
    for (int j = 1; j <= 100; j++) {
      have += num_of[j] * j;
      if (have > M - A[i]) {
        have -= num_of[j] * j;
        int can_take = (M - A[i] - have) / j;
        maximal = so_far + can_take;
        break;
      }
      so_far += num_of[j];
    }
    cout << i - maximal << ' ';
    ++num_of[A[i]];
  }
  cout << '\n';
  return 0;
}
