#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<long long int, long long int> &a,
               const pair<long long int, long long int> &b) {
  return (a.second < b.second);
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
bool inline isPrime(long long int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
bool isPowerOfTwo(long long int n) {
  if (n == 0) return false;
  return (ceil(log2(n)) == floor(log2(n)));
}
bool prt(vector<long long int> e) {
  for (auto &i : e) cout << i << " ";
  cout << "\n";
}
void yes(int i) {
  if (i == 1)
    cout << "YES\n";
  else
    cout << "NO\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int test = 1;
  while (test--) {
    long long int n, m, temp;
    cin >> n >> m;
    vector<long long int> tim(100, 0);
    long long int sz = 0;
    for (long long int i = (0); i < (n); i += 1) {
      cin >> temp;
      long long int rem = m - temp, s = 0, itr = 99, ans = 0;
      long long int foo = sz;
      if (foo > rem) {
        while (itr >= 0) {
          foo -= tim[itr] * (itr + 1);
          ans += tim[itr];
          if (foo < rem) {
            foo += tim[itr] * (itr + 1);
            ans -= tim[itr];
            double res = foo - rem;
            long long int bacha = (long long int)ceil(res / (itr + 1));
            ans += bacha;
            foo -= bacha * (itr + 1);
          }
          itr--;
          if (foo <= rem) break;
        }
      }
      cout << ans << "\n";
      tim[temp - 1]++;
      sz += temp;
    }
  }
}
