#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, m;
  cin >> n >> m;
  vector<long long> v(n);
  for (long long i = 0; i < n; i++) cin >> v[i];
  vector<long long> dp(n);
  dp[0] = v[0];
  for (long long i = 1; i < dp.size(); i++) {
    dp[i] = v[i] + dp[i - 1];
  }
  for (long long i = 0; i < n; i++) {
    vector<long long> temp;
    long long ans = 0;
    for (long long j = 0; j < i; j++) {
      temp.push_back(v[j]);
    }
    if (temp.size() > 0) {
      sort(temp.rbegin(), temp.rend());
    }
    long long timereq = v[i];
    long long timeleft = m;
    long long in = 0;
    if (i > 0) {
      timeleft = m - dp[i - 1];
    }
    while (true) {
      if (timeleft >= timereq) break;
      timeleft = timeleft + temp[in];
      in++;
      ans++;
    }
    cout << ans << " ";
  }
}
