#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const long long inf = 1e18;
const int maxn = 1e5 + 10;
const double eps = 1e-7;
const double pi = 3.14159265359;
int n, m, t[maxn];
int par[maxn];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> t[i];
  }
  par[0] = t[0];
  for (int i = 1; i < n; i++) {
    par[i] = par[i - 1] + t[i];
  }
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      cout << 0 << " ";
      continue;
    }
    sort(t, t + i);
    int res = 0;
    int s = par[i];
    int id = i - 1;
    while (s > m) {
      s -= t[id];
      id--;
      res++;
    }
    cout << res << " ";
  }
}
