#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
int n, m, sum[107], i, j, id, x, tot, res, now, ans[N];
int main() {
  cin >> n >> m;
  for (id = 1; id <= n; ++id) {
    cin >> x;
    tot = now;
    int& res = ans[id];
    for (i = 100; i >= 1 && tot + x > m; --i)
      if (sum[i]) {
        if (tot - sum[i] * i + x > m) {
          res += sum[i];
          tot -= sum[i] * i;
        } else {
          j = tot + x - m;
          res += j / i + (j % i != 0);
          break;
        }
      }
    now += x;
    sum[x]++;
  }
  for (i = 1; i <= n; ++i) printf("%d ", ans[i]);
  puts("");
  return 0;
}
