#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  ;
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int n, m;
  cin >> n >> m;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  multiset<int> s;
  for (int i = 0; i < n; i++) {
    int tmp = m - a[i];
    int cnt = 0;
    for (auto it : s) {
      if (tmp >= it) {
        tmp -= it;
        cnt++;
      } else {
        break;
      }
    }
    cout << i - cnt << " ";
    s.insert(a[i]);
  }
  cout << '\n';
  return 0;
}
