#include <bits/stdc++.h>
using namespace std;
long long a[200100];
long long w[200];
int main() {
  ios::sync_with_stdio(false);
  long long n, t;
  cin >> n >> t;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  multiset<long long> al;
  long long tot = 0;
  for (int i = 0; i < n; i++) {
    tot += a[i];
    if (tot <= t) {
      cout << 0 << " ";
    } else {
      long long fmn = tot - t;
      long long sol = 0;
      for (long long j = 100; j >= 1 && fmn > 0; j--) {
        if (w[j] > 0) {
          long long b = fmn / j;
          if (fmn % j != 0) b++;
          if (b <= w[j]) {
            sol += b;
            fmn -= (b * j);
            break;
          } else {
            fmn -= (w[j] * j);
            sol += w[j];
          }
        }
      }
      cout << sol << " ";
    }
    w[a[i]]++;
  }
  cout << endl;
  return 0;
}
