#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int a[n];
  int presum[n + 1];
  cin >> a[0];
  presum[0] = a[0];
  for (int i = 1; i < n; i++) {
    cin >> a[i];
    presum[i] = presum[i - 1] + a[i];
  }
  cout << 0 << " ";
  for (int i = 1; i < n; i++) {
    priority_queue<int> pq;
    for (int j = 0; j < i; j++) {
      pq.push(a[j]);
    }
    int sum = presum[i - 1];
    if (m - presum[i - 1] >= a[i]) {
      cout << 0 << " ";
    } else {
      int cnt = 0;
      while (m - sum < a[i]) {
        sum = sum - pq.top();
        pq.pop();
        cnt++;
      }
      cout << cnt << " ";
    }
  }
  return 0;
}
