#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
int cnt[102];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, M;
  cin >> n >> M;
  for (int j = 0; j < n; ++j) {
    int x;
    cin >> x;
    int m = M - x;
    int taken = 1;
    int sum = 0;
    for (int i = 1; i <= 100; ++i) {
      if (sum > m) {
        break;
      }
      int k = min(cnt[i], (m - sum) / i);
      sum += k * i;
      taken += k;
      if (cnt[i] > k) {
        break;
      }
    }
    cnt[x]++;
    cout << j + 1 - taken << " ";
  }
  cout << "\n";
  return 0;
}
