#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int i, j, k, n, m, x, y, count;
  cin >> n >> m;
  int a[n + 1], b[n + 1], c[101], ans[n + 1];
  memset(ans, 0, sizeof(ans));
  memset(c, 0, sizeof(c));
  a[0] = b[0] = 0;
  for (i = 1; i <= n; i += 1) {
    cin >> a[i];
    b[i] = a[i] + b[i - 1];
  }
  for (i = 1; i <= n; i += 1) {
    x = a[i - 1];
    c[x] += 1;
    x = b[i - 1];
    y = m - a[i];
    if (y >= x)
      ans[i] = 0;
    else {
      y = x - y;
      x = 0, k = 100, count = 0;
      while (x < y && k > 0) {
        x += k * c[k];
        if (x <= y) {
          count += c[k];
          k -= 1;
        } else {
          x -= k * c[k];
          j = y - x;
          count += ceil((1.0 * j) / k);
          x = y;
        }
      }
      ans[i] = count;
    }
  }
  for (i = 1; i <= n; i += 1) cout << ans[i] << " ";
  cout << endl;
}
