#include <bits/stdc++.h>
using namespace std;
int n, M, t[200005], s[200005];
int main() {
  cin >> n >> M;
  memset(s, 0, sizeof(s));
  for (int i = 1; i <= n; ++i) {
    cin >> t[i];
    s[i] = s[i - 1] + t[i];
  }
  for (int i = 1; i <= n; ++i) {
    int cnt = 0;
    if (s[i] <= M)
      printf("0 ");
    else {
      priority_queue<int> pq(t + 1, t + i);
      int a = s[i];
      while (a > M) {
        a -= pq.top();
        ++cnt;
        pq.pop();
      }
      printf("%d ", cnt);
    }
  }
  printf("\n");
  return 0;
}
