#include <bits/stdc++.h>
using namespace std;
long long a, b, c, d, n, m, k, q, t;
string second, v;
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> t;
  long long arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (int i = 0; i < n; i++) {
    if (b + arr[i] > t) {
      sort(arr, arr + i);
      c = b;
      d = 0;
      for (int x = i - 1; x >= 0; x--) {
        c -= arr[x];
        d++;
        if (c + arr[i] <= t) break;
      }
      cout << d << " ";
      b += arr[i];
    } else {
      b += arr[i];
      cout << 0 << " ";
    }
  }
}
