#include <bits/stdc++.h>
using namespace std;
vector<int> v;
int arr[200];
int sum = 0;
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    int temp = m - x;
    int ans = 0;
    if (sum > temp) {
      temp = sum - temp;
      for (auto it = v.rbegin(); it != v.rend(); it++) {
        temp -= *it;
        ans++;
        if (temp <= 0) break;
      }
    }
    cout << ans << " ";
    v.push_back(x);
    sum += x;
    sort(v.begin(), v.end());
  }
  return 0;
}
