#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
void solve() {
  int n, m;
  cin >> n >> m;
  vector<long long int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  vector<int> ans(n);
  ans[0] = 0;
  priority_queue<long long int> mx;
  for (int i = 1; i < n; i++) {
    long long int sum = 0;
    priority_queue<long long int> pq;
    for (int j = 0; j < i; j++) {
      sum += v[j];
      pq.push(v[j]);
    }
    int cnt = 0;
    while (!pq.empty()) {
      if (sum + v[i] <= m) {
        break;
      } else {
        sum -= pq.top();
        pq.pop();
        cnt++;
      }
    }
    ans[i] = cnt;
  }
  for (auto it : ans) {
    cout << it << " ";
  }
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) solve();
  return 0;
}
