#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int infi = 1147483600;
const long long infl = 1e17;
const char ENDL = '\n';
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m;
  cin >> n >> m;
  vector<long long> t(n);
  for (long long i = 0; i < (long long)n; i++) cin >> t[i];
  for (long long i = 0; i < (long long)n; i++) {
    long long s = 0;
    vector<long long> ti(i);
    for (long long j = 0; j < (long long)i; j++) {
      ti[j] = t[j];
      s += ti[j];
    }
    s += t[i];
    sort((ti).begin(), (ti).end(), greater<long long>());
    int cnt = 0;
    while (s > m) {
      s -= ti[cnt];
      cnt++;
    }
    cout << cnt << " ";
  }
  cout << ENDL;
}
