#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 100;
int n, m, ans;
long long a[MAXN], stSum;
multiset<long long, greater<long long> > st;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    ans = 0;
    vector<long long> v;
    v.clear();
    while (stSum + a[i] > m && st.size() > 0) {
      ans++;
      stSum -= *(st.begin());
      v.push_back(*(st.begin()));
      st.erase(st.begin());
    }
    cout << ans << " ";
    for (auto x : v) {
      st.insert(x);
      stSum += x;
    }
    st.insert(a[i]);
    stSum += a[i];
  }
  return 0;
}
