#include <bits/stdc++.h>
int main() {
  int n, M;
  std::cin >> n >> M;
  std::vector<int> arr(n, 0);
  for (int i = 0; i < n; i++) {
    std::cin >> arr[i];
  }
  int sum = 0;
  for (int i = 0; i < n; i++) {
    sum += arr[i];
    if (sum <= M) {
      std::cout << 0 << " ";
    } else {
      std::sort(arr.begin(), arr.begin() + i);
      int temp = sum;
      int ind = i - 1;
      int needToLeave = 0;
      while (temp > M) {
        temp -= arr[ind--];
        needToLeave++;
      }
      std::cout << needToLeave << " ";
    }
  }
  std::cout << "\n";
  return 0;
}
