#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, m;
  cin >> n >> m;
  long long a[n], i, f[102] = {0};
  for (i = 0; i <= n - 1; i++) {
    cin >> a[i];
  }
  long long tot = 0;
  for (i = 0; i <= n - 1; i++) {
    tot += a[i];
    if (tot <= m) {
      cout << 0 << " ";
      f[a[i]]++;
      continue;
    }
    long long ans = 0, rem = tot - m, j;
    for (j = 100; j >= 1; j--) {
      long long av = min(f[j], (long long)ceil((long double)rem / j));
      rem -= av * j;
      if (rem <= 0) {
        ans += av;
        break;
      } else
        ans += av;
    }
    f[a[i]]++;
    cout << ans << " ";
  }
  return 0;
}
