#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int a[n];
  vector<int> b;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int k = 0, sum = 0;
  for (int i = 0; i < n; i++) {
    sum += a[i];
    if (sum <= m) {
      cout << "0"
           << " ";
      b.push_back(a[i]);
    } else {
      int s = b.size() - 1;
      sort(b.begin(), b.end());
      int sum2 = sum;
      int c = 0;
      while (sum2 > m) {
        sum2 -= b[s];
        s--;
        c++;
      }
      cout << c << " ";
      b.push_back(a[i]);
    }
  }
  return 0;
}
