#include <bits/stdc++.h>
using namespace std;
int binarySearch(long long arr[], int l, int r, int x) {
  if (r >= l) {
    int mid = l + (r - l) / 2;
    if (arr[mid] == x) return mid;
    if (arr[mid] > x) return binarySearch(arr, l, mid - 1, x);
    return binarySearch(arr, mid + 1, r, x);
  }
  return -1;
}
vector<long long> divisor(long long n) {
  vector<long long> v;
  for (int i = 1; i <= sqrt(n); i++) {
    if (n % i == 0)
      if (n / i == i)
        v.push_back(i);
      else {
        v.push_back(i);
        v.push_back(n / i);
      }
  }
  return v;
}
bool cmp(string a, string b) { return a.size() < b.size(); }
int main() {
  long long n, m;
  cin >> n >> m;
  vector<int> v(n), a;
  for (int i = 0; i < n; i++) cin >> v[i];
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    sum = sum + v[i];
    long long count = 0;
    if (sum > m) {
      long long sum1 = sum;
      int j = 0;
      sort(v.begin(), v.begin() + i);
      while (1) {
        sum1 = sum1 - v[i - 1 - j];
        j++;
        count++;
        if (sum1 <= m) break;
      }
    }
    cout << count << " ";
  }
}
