#include <bits/stdc++.h>
int main() {
  long int z, n, m, i, j, k, l, max, S, Sum, c, p, f;
  scanf("%ld %ld", &n, &m);
  max = m;
  S = 0;
  long int ar[n];
  long int ma[n];
  for (i = 0; i < n; i++) {
    scanf("%ld", &ar[i]);
    ma[i] = -1;
  }
  for (i = 0; i < n; i++) {
    S = S + ar[i];
    if (S <= m) {
      printf("0 ");
    } else {
      p = 0;
      k = 0;
      Sum = 0;
      c = 0;
      f = -1;
      z = -1;
      while ((S - Sum) > m) {
        f = -1;
        p = 0;
        z = -1;
        for (j = i - 1; j >= 0; j--) {
          f = -1;
          if (ar[j] > p) {
            for (l = 0; l < k; l++) {
              if (ma[l] == j) {
                f = 1;
                break;
              }
            }
            if (f == 1) continue;
            p = ar[j];
            z = j;
          }
        }
        ma[k++] = z;
        Sum = Sum + p;
        c++;
      }
      printf("%ld ", c);
    }
  }
}
