#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e6 + 1, mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, m;
  cin >> n >> m;
  priority_queue<long long> pq;
  int cnt = 0;
  long long sum = 0;
  for (long long i = 0; i < n; i++) {
    cnt = 0;
    long long x;
    cin >> x;
    sum += x;
    vector<long long> v;
    long long sum1 = sum;
    while (sum1 > m) {
      sum1 -= pq.top();
      v.push_back(pq.top());
      pq.pop();
      cnt++;
    }
    cout << cnt << " ";
    pq.push(x);
    while (!v.empty()) {
      pq.push(v.back());
      v.pop_back();
    }
  }
  return 0;
}
