#include <bits/stdc++.h>
const long long inf = 0x3f3f3f3f3f3f3f3LL;
const long long mod = (long long)1e9 + 7;
using namespace std;
template <class T>
void smin(T& a, T val) {
  if (a > val) a = val;
}
template <class T>
void smax(T& a, T val) {
  if (a < val) a = val;
}
const long long N = 5 * (long long)1e5 + 10;
long long n, m;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m;
  vector<long long> a;
  a.resize(n);
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (long long i = 0; i < n; ++i) {
    long long sum = a[i];
    vector<long long> v;
    for (long long j = 0; j < i; ++j) {
      v.push_back(a[j]);
    }
    sort(v.begin(), v.end());
    long long tot = 1;
    for (auto it : v) {
      sum += it;
      if (sum > m) break;
      tot++;
    }
    cout << (i + 1) - tot << ' ';
  }
  return 0;
}
