#include <bits/stdc++.h>
using namespace std;
vector<int> v;
int a[200], bb[200];
int main() {
  int n, m;
  scanf("%d", &n);
  scanf("%d", &m);
  int sum = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n; i++) {
    sum = a[i];
    int ok = i;
    bool b = 0;
    for (int k = 1; k <= i; k++) bb[k] = a[k];
    sort(bb + 1, bb + 1 + i - 1);
    for (int j = 1; j < i; j++) {
      if (sum + bb[j] > m) {
        ok = j;
        b = 1;
        break;
      } else
        sum += bb[j];
    }
    if (b)
      cout << i - ok << " ";
    else
      cout << 0 << " ";
  }
}
