#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
int mod = 1000000007;
int INF = 1e9;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  int a[n];
  int i;
  int pre[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
    if (i == 0)
      pre[i] = a[i];
    else
      pre[i] = pre[i - 1] + a[i];
  }
  vector<int> ans(n);
  for (i = 0; i < n; i++) {
    if (i == 0)
      ans[i] = 0;
    else {
      if (pre[i] <= m) {
        ans[i] = 0;
      } else {
        int j;
        vector<int> res;
        for (j = i - 1; j >= 0; j--) {
          res.push_back(a[j]);
        }
        sort(res.begin(), res.end(), greater<int>());
        int cnt = 0;
        j = 0;
        int s = pre[i];
        while (j < res.size()) {
          s = s - res[j];
          cnt++;
          j++;
          if (s <= m) break;
        }
        ans[i] = cnt;
      }
    }
  }
  for (i = 0; i < n; i++) {
    cout << ans[i] << " ";
  }
}
