#include <bits/stdc++.h>
using namespace std;
int main(void) {
  std::ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, m;
  cin >> n >> m;
  vector<long long int> vect(n);
  vector<long long int> dp(n);
  for (int i = 0; i < n; i++) {
    cin >> vect[i];
    if (i > 0) {
      dp[i] = dp[i - 1] + vect[i];
    } else {
      dp[0] = vect[0];
    }
  }
  for (int i = 0; i < n; i++) {
    if (dp[i] <= m) {
      cout << 0 << " ";
      continue;
    } else {
      vector<long long int> vect1(n);
      vect1 = vect;
      sort(vect1.begin(), vect1.begin() + i);
      int counter = 0;
      int j = i - 1;
      while (dp[i] > m && j >= 0) {
        dp[i] -= vect1[j];
        j--;
        counter++;
      }
      cout << counter << " ";
      continue;
    }
  }
}
