#include <bits/stdc++.h>
using namespace std;
int arr[200], exi[200] = {0};
int n, m, sum = 0;
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
    sum += arr[i];
    if (sum > m) {
      sort(arr, arr + i);
      int temp = sum, cont = 0, pos = i - 1;
      while (temp > m) {
        temp -= arr[pos--];
        cont++;
      }
      exi[i] = cont;
    }
  }
  for (int i = 0; i < n; i++) {
    printf("%d ", exi[i]);
  }
  return 0;
}
