#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  auto start = high_resolution_clock::now();
  long long n, m;
  cin >> n >> m;
  vector<long long> v1;
  for (long long i = 0; i < n; i++) {
    long long a;
    cin >> a;
    v1.push_back(a);
  }
  long long sum = v1[0];
  cout << 0 << " ";
  for (long long i = 1; i < n; i++) {
    sum += v1[i];
    if (sum > m) {
      vector<long long> v2(v1.begin(), v1.begin() + i);
      sort(v2.begin(), v2.end(), greater<long long>());
      long long j = 0;
      long long l = sum - m;
      long long count = 0;
      while (l > 0) {
        count++;
        l -= v2[j];
        j++;
      }
      cout << count << " ";
    } else
      cout << 0 << " ";
  }
  auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start);
  return 0;
}
