#include <bits/stdc++.h>
using namespace std;
const int maxn = 105;
int n, m;
int t[maxn];
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", &t[i]);
  }
  for (int i = 0; i < n; i++) {
    priority_queue<int, vector<int>, greater<int> > q;
    for (int j = 0; j < i; j++) {
      q.push(t[j]);
    }
    int sum = 0, cnt = 0;
    while (!q.empty() && (sum += q.top()) + t[i] <= m) {
      q.pop();
      cnt++;
    }
    if (i != 0) printf(" ");
    printf("%d", i - cnt);
  }
  printf("\n");
  return 0;
}
