#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> v;
vector<int> count1;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  v.resize(n + 1);
  count1.resize(105);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  int sum = 0;
  for (int i = 0; i < n; i++) {
    int toremove = sum + v[i] - m;
    if (toremove > 0) {
      int ans = 0;
      for (int k = 100; k > 0; k--) {
        int avail = k * count1[k];
        if (avail >= toremove) {
          ans += ceil((double)toremove / (double)k);
          break;
        }
        toremove -= avail;
        ans += count1[k];
      }
      cout << ans << " ";
    } else {
      cout << 0 << " ";
    }
    count1[v[i]]++;
    sum += v[i];
  }
  return 0;
}
