#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
const int MOD = 1e9 + 7;
long long int a[N], pref[N], h[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, sum;
  cin >> n >> sum;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    pref[i] = pref[i - 1] + a[i];
  }
  for (int i = 1; i <= n; i++) {
    if (pref[i] <= sum) {
      cout << 0 << " ";
    } else {
      long long int diff = pref[i] - sum;
      long long int ans = 0, ct = 0;
      for (int j = 100; j >= 1; j--) {
        if (h[j]) {
          if ((ct + (j * h[j])) <= diff) {
            ct += (j * h[j]);
            ans += h[j];
          } else {
            long long int tt = ((diff - ct) + (j - 1)) / j;
            ans += tt;
            ct += tt * j;
          }
        }
        if (ct >= diff) break;
      }
      cout << ans << " ";
    }
    h[a[i]]++;
  }
  return 0;
}
