#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int n, m;
  cin >> n >> m;
  vector<int> v;
  int a[n], b[n];
  for (int i = 0; i < n; ++i) {
    b[i] = 0;
  }
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  cout << "0 ";
  int time = 0, ctime;
  time += a[0];
  b[0] = a[0];
  for (int i = 1; i < n; ++i) {
    if (time + a[i] <= m)
      cout << "0 ";
    else {
      ctime = time;
      int count = 0;
      sort(b, b + n, greater<int>());
      for (int j = 0; j < i; ++j) {
        ctime -= b[j];
        count++;
        if (ctime + a[i] <= m) {
          cout << count << " ";
          break;
        }
      }
    }
    time += a[i];
    b[i] = a[i];
  }
  return 0;
}
