#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a;
  cin >> n >> a;
  int mass[n];
  for (int i = 0; i < n; i++) cin >> mass[i];
  int c = 0;
  vector<int> res;
  for (int i = 0; i < n; i++) {
    if ((mass[i] + c) <= a) {
      cout << 0 << " ";
      c += mass[i];
      res.push_back(mass[i]);
    } else {
      int c1 = c;
      reverse(res.begin(), res.end());
      int x1 = 0;
      while ((c1 + mass[i]) > a && x1 < n) {
        c1 -= res[x1];
        x1++;
      }
      cout << x1 << " ";
      c += mass[i];
      res.push_back(mass[i]);
    }
    sort(res.begin(), res.end());
  }
}
