#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long m;
  long long n, k = 0, k1 = 0, k2 = 0, sm = 0, nm = 0, sm_original, f = 0;
  string s, s1, s2;
  cin >> n >> m;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < n - 1 && sm + a[i] <= m; i++) {
    cout << 0 << ' ';
    sm += a[i];
    nm = i;
    f = 1;
  }
  if (f == 0) nm--;
  sm_original = sm;
  long long kek = nm;
  for (long long i = nm + 1; i < n; i++) {
    sort(a.begin(), a.end() - n + i);
    kek = i - 1;
    sm = sm_original;
    while (sm + a[i] > m) {
      sm -= a[kek];
      k++;
      kek--;
    }
    sm_original += a[i];
    cout << k << ' ';
    k = 0;
  }
}
