#include <bits/stdc++.h>
using namespace std;
int ans[200000 + 8];
int num[200];
int n, m;
int sum = 0, cnt = 0;
bool cmp(int a, int b) { return a > b; }
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    int u;
    scanf("%d", &u);
    sum += u;
    if (sum <= m)
      ans[i] = 0;
    else {
      int x = sum - m;
      for (int p = 100; p >= 1 && x > 0; --p) {
        if (!num[p]) continue;
        x -= num[p] * p;
        ans[i] += num[p];
        if (x < 0) {
          for (; x <= 0; x += p, --ans[i])
            ;
          ++ans[i];
          break;
        }
      }
    }
    ++num[u];
  }
  for (int i = 1; i <= n; ++i) printf("%d ", ans[i]);
}
