#include <bits/stdc++.h>
using namespace std;
long long int ans(vector<long long int> times, vector<long long int> cum,
                  long long int i, long long int M) {
  if (cum[i] <= M) {
    return 0;
  } else {
    sort(times.begin(), times.begin() + i);
    long long int diff = cum[i] - M;
    long long int count = 0;
    long long int sum = 0;
    for (long long int j = i - 1; j >= 0; j--) {
      sum += times[j];
      count++;
      if (sum >= diff) return count;
    }
  }
  return -1;
}
int main() {
  long long int n, M;
  cin >> n >> M;
  vector<long long int> times;
  vector<long long int> cum;
  long long int sum = 0;
  for (long long int i = 0; i < n; i++) {
    long long int temp;
    cin >> temp;
    sum += temp;
    times.push_back(temp);
    cum.push_back(sum);
  }
  for (long long int i = 0; i < n; i++) {
    cout << ans(times, cum, i, M) << " ";
  }
}
