#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, second = 0;
  cin >> n >> m;
  int *a = new int[n];
  vector<int> v;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    second += a[i];
    if (second <= m) {
      cout << 0 << " ";
      continue;
    } else {
      for (int j = 0; j < i; j++) v.push_back(a[j]);
      sort(v.begin(), v.end(), greater<int>());
      int c = 1, s1 = 0;
      for (auto it : v) {
        s1 += it;
        if (second - s1 > m) {
          c++;
          continue;
        } else {
          cout << c << " ";
          break;
        }
      }
      v.clear();
    }
  }
  return 0;
}
