#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  vector<int> t(n);
  for (int i = 0; i < n; i++) {
    cin >> t[i];
  }
  vector<int> cnt(101, 0);
  int sum = 0;
  for (int i = 0; i < n; i++) {
    int d = sum + t[i] - m;
    int y, k = 0;
    if (d > 0) {
      for (int j = 100; j >= 1; j--) {
        int x = j * cnt[j];
        if (x >= d) {
          k += (d + j - 1) / j;
          break;
        }
        d -= x;
        k += cnt[j];
      }
    }
    sum += t[i];
    cnt[t[i]]++;
    cout << k << " ";
  }
  return 0;
}
