#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int sum = 0;
  int cnt;
  int ar[n + 5];
  int br[n + 5];
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
    br[i] = ar[i];
  }
  for (int i = 0; i < n; i++) {
    sum += ar[i];
    int tum = sum;
    sort(br, br + i, greater<int>());
    cnt = 0;
    if (sum <= m) {
      cout << "0"
           << " ";
    } else {
      while (tum > m) {
        tum = tum - br[cnt];
        cnt++;
      }
      cout << cnt << " ";
    }
  }
  cout << endl;
  return 0;
}
