#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, M;
  cin >> n >> M;
  vector<long long> t(n);
  for (long long i = 0; i < n; i++) {
    cin >> t[i];
  }
  vector<long long> count(101);
  long long sum = 0;
  for (long long i = 0; i < n; i++) {
    long long j = 100;
    long long temp_sum = sum;
    long long chel = 0;
    while (temp_sum + t[i] > M) {
      if (temp_sum + t[i] - count[j] * j > M) {
        temp_sum -= count[j] * j;
        chel += count[j];
      } else {
        chel += (temp_sum + t[i] - M + j - 1) / j;
        break;
      }
      j--;
    }
    sum += t[i];
    count[t[i]]++;
    cout << chel << " ";
  }
  return 0;
}
