#include <bits/stdc++.h>
using namespace std;
const int N = 105;
int dp[N][N * N], sum[N], a[N];
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  clock_t tStart = clock();
  int n, m;
  cin >> n >> m;
  for (int i = (1), _b = (n); i <= _b; i++) {
    cin >> a[i];
    sum[i] = sum[i - 1] + a[i];
  }
  for (int i = (0), _b = (N - 4); i <= _b; i++)
    for (int j = (0), _b = (N * N - 5); j <= _b; j++) dp[i][j] = N;
  dp[0][0] = 0;
  for (int i = (1), _b = (n); i <= _b; i++) {
    for (int j = (0), _b = (sum[i]); j <= _b; j++) {
      dp[i][j] = dp[i - 1][j];
      if (j - a[i] >= 0) dp[i][j] = min(dp[i][j], dp[i - 1][j - a[i]] + 1);
    }
    int ret = N;
    if (sum[i] < m) {
      cout << "0 ";
      continue;
    }
    for (int j = (sum[i] - m), _b = (sum[i]); j <= _b; j++)
      ret = min(ret, dp[i - 1][j]);
    cout << ret << ' ';
  }
  fprintf(stderr, "Time taken: %.2fs\n",
          (double)(clock() - tStart) / CLOCKS_PER_SEC);
  return 0;
}
