#include <bits/stdc++.h>
using namespace std;
int n, m, t, cnt[105];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  int total = 0;
  for (int i = 0; i < n; i++) {
    cin >> t;
    total += t;
    int need = total, id = 100, ans = 0;
    while (id > 0 && m - need < 0) {
      int many = min(cnt[id], (need - m) / id + ((need - m) % id != 0));
      need -= many * id;
      id--;
      ans += many;
    }
    cnt[t]++;
    if (i) cout << ' ';
    cout << ans;
  }
  cout << '\n';
  return 0;
}
