#include <bits/stdc++.h>
using namespace std;
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m, i, j, k;
  cin >> n >> m;
  vector<long long> v1, v2;
  long long a[n], b[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    b[i] = a[i];
  }
  for (long long i = 1; i < n; i++) b[i] += b[i - 1];
  for (i = 0; i < n; i++) {
    if (b[i] <= m) {
      v1.push_back(a[i]);
      v2.push_back(0);
    } else {
      long long x = b[i] - m, j = 0, c = 0, s = 0;
      sort(v1.begin(), v1.end(), greater<long long>());
      while (1) {
        if (j == v1.size() || s >= x)
          break;
        else {
          c++;
          s += v1[j];
          j++;
        }
      }
      v1.push_back(a[i]);
      v2.push_back(c);
    }
  }
  for (auto w : v2) cout << w << " ";
  return 0;
}
