#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  int t[n];
  for (int i = 0; i < n; i++) {
    cin >> t[i];
  }
  int cnt[n];
  for (int i = 0; i < n; i++) {
    cnt[i] = 0;
  }
  multiset<int, greater<int>> s;
  int sum = 0;
  int presum[n];
  presum[0] = t[0];
  for (int i = 1; i < n; i++) {
    presum[i] = presum[i - 1] + t[i];
  }
  for (int i = 0; i < n; i++) {
    while (presum[i] > m) {
      multiset<int, greater<int>>::iterator itr;
      itr = s.begin();
      int val = *itr;
      s.erase(itr);
      presum[i] -= val;
      cnt[i] += 1;
    }
    s.clear();
    for (int j = 0; j <= i; j++) {
      s.insert(t[j]);
    }
  }
  for (int i = 0; i < n; i++) {
    cout << cnt[i] << " ";
  }
  cout << endl;
  return 0;
}
