#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t;
  cin >> n >> t;
  double arr[n];
  map<double, double> m;
  for (int i = 0; i < n; i++) cin >> arr[i];
  priority_queue<double> pq;
  double currT = 0;
  for (int i = 0; i < n; i++) {
    currT += arr[i];
    double tmp = currT;
    priority_queue<double> ptmp = pq;
    double ans = 0;
    while (tmp > t) {
      if (tmp - (m[ptmp.top()] * ptmp.top()) <= t) {
        ans += ceil((tmp - t) / ptmp.top());
        break;
      } else
        tmp -= m[ptmp.top()] * ptmp.top();
      ans += m[ptmp.top()];
      ptmp.pop();
    }
    cout << ans << " ";
    if (!m[arr[i]]) pq.push(arr[i]);
    m[arr[i]]++;
  }
}
