#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, j, k, f, d, p, c;
  int num[200];
  int st[200];
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> k;
    num[i] = st[i] = k;
  }
  int s = 0;
  for (i = 0; i < n; i++) {
    s += num[i];
    if (s <= m)
      cout << 0 << " ";
    else
      break;
  }
  for (j = i; j < n; j++) {
    s = num[j];
    sort(st, st + j);
    d = j;
    c = 0;
    for (k = 0; k < j; k++) {
      if (s + st[k] <= m) {
        s += st[k];
        c++;
      } else
        break;
    }
    cout << d - c << " ";
  }
  cout << endl;
  return 0;
}
