#include <bits/stdc++.h>
using namespace std;
const long long int inf = 1e9 + 7;
const long long int modc = 998244353;
struct cmp {
  bool operator()(long long int a, long long int b) { return a > b; }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long int n, m;
  cin >> n >> m;
  vector<long long int> t(n);
  for (long long int i = 0; i < n; i++) cin >> t[i];
  long long int sum = 0;
  long long int p = -1;
  multiset<long long int, cmp> A;
  for (long long int i = 0; i < n; i++) {
    sum += t[i];
    if (sum > m) {
      sum -= t[i];
      p = i;
      break;
    }
    A.insert(t[i]);
  }
  if (p == -1) {
    for (long long int i = 0; i < n; i++)
      cout << "0"
           << " ";
    cout << "\n";
    return 0;
  }
  vector<long long int> mark(n + 1, 0);
  int a = 0;
  for (int i = p; i < n; i++) {
    sum += t[i];
    a = sum - m;
    int c = 0, s = 0;
    for (auto x : A) {
      c += x;
      s++;
      if (c >= a) {
        mark[i + 1] = s;
        break;
      }
    }
    A.insert(t[i]);
  }
  for (long long int i = 1; i <= n; i++) cout << mark[i] << " ";
  cout << "\n";
  return 0;
}
