#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int a[n + 1], b[n + 1];
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    int sum = m, j;
    sum = sum - a[i];
    for (j = 1; j < i; j++) {
      b[j] = a[j];
    }
    sort(b + 1, b + j);
    int x = 1;
    while ((sum >= b[x]) && (x < i)) {
      sum = sum - b[x];
      x++;
    }
    x--;
    cout << i - 1 - x << " ";
  }
  return 0;
}
