#include <bits/stdc++.h>
using namespace std;
int cnt[105];
int main() {
  int n, M;
  scanf("%d%d", &n, &M);
  int total = 0;
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    total += x;
    int cur = total;
    int taken = 0;
    for (int j = 100; j >= 1; j--) {
      if (cur - cnt[j] * j <= M) {
        printf("%d ", max(0, taken + (cur - M + j - 1) / j));
        break;
      }
      cur -= cnt[j] * j;
      taken += cnt[j];
    }
    cnt[x]++;
  }
  return 0;
}
