#include <bits/stdc++.h>
long long mod(long long x) {
  if (x < 0) return -x;
  return x;
}
long long expo(long long x, long long y) {
  long long res = 1;
  while (y > 0) {
    if (y % 2 == 1) res = (res * x);
    y = y >> 1;
    x = x * x;
  }
  return res;
}
using namespace std;
const int MAXN = 500005;
vector<long long> v, g;
long long a[1000000], b[1000000];
int main() {
  ios_base::sync_with_stdio(false);
  long long n, t, m, k, x, y;
  cin >> n >> m;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    if (i == 0) {
      b[i] = a[i];
    } else {
      b[i] = b[i - 1] + a[i];
    }
  }
  v.push_back(0);
  for (long long i = 1; i < n; i++) {
    x = a[i];
    y = i;
    for (long long j = i - 1; j >= 0; j--) {
      g.push_back(a[j]);
    }
    sort(g.begin(), g.end());
    for (long long j = 0; j < g.size(); j++) {
      x += g[j];
      if (x > m) {
        y = j;
        break;
      }
    }
    g.clear();
    v.push_back(i - (y));
  }
  for (long long i = 0; i < v.size(); i++) {
    cout << v[i] << " ";
  }
  return 0;
}
