#include <bits/stdc++.h>
using namespace std;
int a[101], b[200001];
int main() {
  int n, m, t, sum = 0, s, g;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", &s);
    sum += s;
    if (sum > m) {
      int sun = sum;
      for (int j = 100; j >= 1; j--) {
        if (a[j] > 0) {
          if ((sun - j * a[j]) <= m) {
            if ((sun - m) % j != 0)
              g = 1;
            else
              g = 0;
            b[i] += ((sun - m) / j + g);
            break;
          } else {
            b[i] += a[j];
            sun -= a[j] * j;
          }
        }
      }
    }
    a[s]++;
  }
  for (int i = 0; i < n; i++) {
    printf("%d ", b[i]);
  }
  printf("\n");
  return 0;
}
