#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  int ar[100];
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> ar[i];
  int sar[100];
  sar[0] = ar[0];
  for (int i = 1; i < n; i++) {
    sar[i] = sar[i - 1] + ar[i];
  }
  for (int i = 0; i < n; i++) {
    if (sar[i] > m) {
      sort(ar, ar + i);
      int cnt = 0, total = 0;
      for (int j = i - 1; j >= 0 and total < sar[i] - m; j--) {
        total += ar[j];
        cnt++;
      }
      cout << cnt << " ";
    } else
      cout << 0 << " ";
  }
  return 0;
}
