#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 1e9 + 7;
const int base = 1e9;
const int MAX = 4e5;
const double EPS = 1e-9;
const double PI = acos(-1.);
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> v(n), pref(n), res(n);
  for (int i = (0); i < (n); ++i) {
    cin >> v[i];
    if (i == 0)
      pref[i] = v[i];
    else
      pref[i] = pref[i - 1] + v[i];
  }
  for (int i = (0); i < (n); ++i) {
    if (i == 0) {
      res[i] = 0;
      continue;
    }
    if (pref[i - 1] + v[i] <= m) {
      res[i] = 0;
      continue;
    }
    sort(v.begin(), v.begin() + i);
    int sum = pref[i], cnt = 0;
    for (int j = (i)-1; j >= (0); --j) {
      if (sum <= m) break;
      sum -= v[j];
      cnt++;
    }
    res[i] = cnt;
  }
  for (int i = (0); i < (n); ++i) {
    cout << res[i] << ' ';
  }
  return 0;
}
