#include <bits/stdc++.h>
using namespace std;
int counter[101];
int main() {
  int n, m;
  scanf("%d", &n);
  scanf("%d", &m);
  int arr[n];
  for (int i = 0; i < n; i++) scanf("%d", &arr[i]);
  cout << 0 << ' ';
  for (int sum, ans, k, j = 1; j < n; j++) {
    counter[arr[j - 1]]++;
    sum = arr[j];
    ans = 0;
    for (int i = 1; i < 101; i++) {
      if (sum + (counter[i] * i) <= m) {
        sum += (counter[i] * i);
        ans += counter[i];
      } else {
        k = (m - sum) / i;
        sum += (k * i);
        ans += k;
      }
    }
    cout << j - ans << ' ';
  }
  return 0;
}
