#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m;
  cin >> n >> m;
  vector<long long> arr(n), pre(n);
  for (int i = 0; i < n; i++) cin >> arr[i];
  pre[0] = arr[0];
  for (int i = 1; i < n; i++) pre[i] = pre[i - 1] + arr[i];
  multiset<long long, greater<long long> > mi;
  vector<long long> ans;
  for (int i = 0; i < n; i++) {
    if (pre[i] <= m) {
      ans.push_back(0);
    } else {
      vector<int> pre2;
      long long val = 0, diff;
      diff = pre[i] - m;
      for (auto i : mi) {
        diff -= i;
        val++;
        if (diff <= 0) break;
      }
      ans.push_back(val);
    }
    mi.insert(arr[i]);
  }
  for (auto i : ans) cout << i << " ";
  return 0;
}
