#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, i, j, a[200005], sum, siz, temp, cnt, x, diff, mx;
  map<long long int, long long int> ma;
  scanf("%lld %lld ", &n, &m);
  for (i = 0; i < n; i++) scanf("%lld", &a[i]);
  for (i = 1; i <= 100; i++) ma[i] = 0;
  sum = 0;
  cnt = 0;
  for (i = 0; i < n; i++) {
    sum = sum + a[i];
    if (sum <= m) {
      printf("0 ");
      ma[a[i]]++;
    } else {
      temp = sum;
      cnt = 0;
      for (j = 100; j >= 1 && temp > m; j--) {
        if (ma[j] == 0)
          continue;
        else {
          diff = temp - m;
          mx = j * ma[j];
          if (mx < diff) {
            temp = temp - j * ma[j];
            cnt = cnt + ma[j];
          } else {
            x = diff / j;
            temp = temp - x * j;
            cnt = cnt + x;
            if (x < ma[j] && temp > m) {
              temp = temp - j;
              cnt++;
            }
          }
        }
      }
      printf("%lld ", cnt);
      ma[a[i]]++;
    }
  }
  printf("\n");
}
