#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long m, n;
  cin >> n >> m;
  multiset<long long, greater<long long>> pass;
  multiset<long long> fail;
  vector<long long> steps;
  long long count = 0;
  long long time = 0;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    time += x;
    long long temp = time;
    count = 0;
    auto itr = pass.begin();
    while (temp > m) {
      temp -= *itr;
      ++itr;
      count++;
    }
    steps.push_back(count);
    pass.insert(x);
  }
  for (auto node : steps) cout << node << " ";
}
