#include <bits/stdc++.h>
using namespace std;
int t[105];
int sum[105] = {0};
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> q;
  for (int i = 0; i < n; i++) {
    cin >> t[i];
    if (i == 0)
      sum[i] = t[i];
    else {
      sum[i] = sum[i - 1] + t[i];
    }
  }
  for (int i = 0; i < n; i++) {
    if (sum[i] > m) {
      sort(q.begin(), q.end());
      int sum1 = 0;
      int count = 0;
      for (int j = i - 1; j >= 0; j--) {
        sum1 += q[j];
        count++;
        if (sum[i] - sum1 <= m) {
          break;
        }
      }
      cout << count << " ";
    } else {
      cout << "0 ";
    }
    q.insert(q.end(), t[i]);
  }
  cout << endl;
  return 0;
}
