#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int MAX = 1e6;
int arr[200000], pos;
int freq[200];
int main() {
  int n, time, i, a, check = 0;
  cin >> n >> time;
  for (i = 0; i < n; i++) {
    cin >> a;
    int ans = a, num = 0;
    for (int j = 1; j <= 100; j++) {
      if (ans + freq[j] * j <= time)
        num += freq[j], ans += freq[j] * j;
      else {
        int temp = time - ans;
        temp /= j;
        num += temp;
        temp *= j;
        ans += temp;
      }
    }
    cout << i - num << " ";
    freq[a]++;
  }
  return 0;
}
