#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, lim;
  cin >> n >> lim;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<int> val(101);
  long long int sum = 0;
  for (int i = 0; i < n; i++) {
    sum += a[i];
    if (sum <= lim) {
      cout << "0 ";
    } else {
      int cont = 0;
      int aux = sum;
      for (int j = 100; j >= 1; j--) {
        if (val[j] > 0) {
          int falta = aux - lim;
          int c = falta / j;
          if (falta % j != 0) c++;
          aux -= (j * min(c, val[j]));
          cont += min(c, val[j]);
        }
        if (aux <= lim) {
          cout << cont << " ";
          break;
        }
      }
    }
    val[a[i]]++;
  }
  return 0;
}
