#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> arr(n), sums(n, 0), ans(n, 0);
  for (int i = int(0); i < int(n); i++) {
    cin >> arr[i];
    if (i > 0)
      sums[i] = arr[i] + sums[i - 1];
    else
      sums[0] = arr[0];
  }
  for (int i = int(0); i < int(n); i++) {
    int idx = i - 1, count = 0;
    sort(arr.begin(), arr.begin() + i);
    while (sums[i] > m && idx >= 0) {
      sums[i] -= arr[idx--];
      count++;
    }
    ans[i] = count;
  }
  for (int i = int(0); i < int(n); i++) cout << ans[i] << " ";
  return 0;
}
