#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int a[n];
  int c[101] = {0};
  for (int i = 0; i < n; i++) cin >> a[i];
  long long int sum = a[0];
  int b[n];
  b[0] = 0;
  c[a[0]]++;
  for (int i = 1; i < n; i++) {
    sum = sum + a[i];
    long long int ex = sum - m;
    if (ex <= 0) {
      b[i] = 0;
      c[a[i]]++;
      continue;
    }
    int cnt = 0;
    for (int k = 100; k >= 1; k--) {
      if (ex <= c[k] * k) {
        cnt += (ex + k - 1) / k;
        ex = 0;
        break;
      }
      cnt = cnt + c[k];
      ex = ex - c[k] * k;
    }
    b[i] = cnt;
    c[a[i]]++;
  }
  for (int i = 0; i < n; i++) cout << b[i] << " ";
  cout << endl;
}
