#include <bits/stdc++.h>
using namespace std;
const int lim = 1e6;
int bucket[200], exi[lim];
long long sum;
int n, m;
int bynary_search(int cant, int valor, int temp) {
  int ini = 0;
  while (ini < cant) {
    int mid = ((ini + cant) / 2) + 1;
    if (temp - (mid * valor) <= m) {
      cant = mid - 1;
    } else {
      ini = mid;
    }
  }
  return ini + 1;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) {
    int aux;
    scanf("%d", &aux);
    sum += aux;
    if (sum > m) {
      long long temp = sum;
      int cont = 0;
      for (int j = 100; j >= 0; j--) {
        if (temp - (j * bucket[j]) == m) {
          cont += bucket[j];
          break;
        } else if (temp - (j * bucket[j]) < m) {
          cont += bynary_search(bucket[j], j, temp);
          break;
        } else {
          temp -= j * bucket[j];
          cont += bucket[j];
        }
      }
      exi[i] = cont;
    }
    bucket[aux]++;
  }
  for (int i = 0; i < n; i++) {
    printf("%d ", exi[i]);
  }
  return 0;
}
