#include <bits/stdc++.h>
using namespace std;
bool cmp(int a, int b) { return a > b; }
int main() {
  int n, M, a[105], ans[105], sum = 0;
  scanf("%d%d", &n, &M);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) {
    sum += a[i];
    int temp = sum;
    if (sum <= M)
      ans[i] = 0;
    else {
      int pos = 0;
      sort(a, a + i, cmp);
      for (int j = 0; temp > M; j++) {
        temp -= a[j];
        pos++;
      }
      ans[i] = pos;
    }
  }
  for (int i = 0; i < n; i++) {
    if (i == 0)
      printf("%d", ans[i]);
    else
      printf(" %d", ans[i]);
  }
  return 0;
}
