#include <bits/stdc++.h>
using namespace std;
long n, m, a[105], s = 0, d[105];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (long i = 1; i <= n; i++) {
    cin >> a[i];
    s += a[i];
    if (s <= m)
      cout << 0 << " ";
    else {
      long tam = 0, dem = 0, danhdau = 0;
      fill(d + 1, d + n + 1, 0);
      for (long j = i - 1; j >= 1; j--) {
        long ma = -5, x = 0;
        for (long k = i - 1; k >= 1; k--) {
          if (a[k] > ma && d[k] == 0) {
            ma = a[k];
            d[x] = 0;
            x = k;
            d[k] = 1;
          }
        }
        tam += ma;
        dem++;
        if (s - tam <= m) {
          cout << dem << " ";
          break;
        }
      }
    }
  }
}
