#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long no_of_input, val;
  long long input;
  vector<long long> vect1;
  vector<long long> count(101, 0);
  cin >> no_of_input >> val;
  for (long long i = 0; i < no_of_input; i++) {
    cin >> input;
    vect1.push_back(input);
  }
  long long currsum = 0;
  for (long long i = 0; i < vect1.size(); i++) {
    long long countt = 0;
    currsum += vect1[i];
    long long temp = currsum;
    temp -= val;
    for (long long j = 100; j >= 1; j--) {
      if (temp <= 0) {
        continue;
      } else {
        long long idk = (temp / j) + (temp % j != 0);
        countt += min(count[j], (long long)idk);
        temp -= min(count[j], (long long)idk) * j;
      }
    }
    count[vect1[i]]++;
    cout << countt << " ";
  }
}
