#include <bits/stdc++.h>
using ll = long long;
const int INF = 0x3f3f3f3f;
using namespace std;
int n, t, m, arr[101], d;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> t;
  for (int i = 0; i < n; ++i) {
    cin >> d;
    if (d <= t) {
      t -= d;
      arr[d]++;
      cout << 0 << " ";
    } else {
      ll tmp = d - t;
      int cnt = 0;
      for (int i = 100; i; --i) {
        if (tmp <= 0) {
          break;
        }
        ll tmp2 = ((tmp + (i - 1)) / i);
        cnt += min(tmp2, (ll)arr[i]);
        tmp -= min(tmp2, (ll)arr[i]) * i;
      }
      cout << cnt << " ";
      arr[d]++;
      t -= d;
    }
  }
  return 0;
}
