#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, M;
  cin >> n >> M;
  vector<int> ti;
  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    int onaddtemp = M - temp;
    sort(ti.begin(), ti.end());
    int j = 0;
    while (j < ti.size() && onaddtemp >= ti[j]) {
      onaddtemp -= ti[j];
      j++;
    }
    ti.push_back(temp);
    int toleave = ti.size() - j;
    cout << toleave - 1 << " ";
  }
  return 0;
}
