#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, cnt = 0;
  vector<int> a(n);
  cin >> n >> x;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  int j = 0;
  while (x >= 0) {
    x -= a[j];
    j++;
    cnt++;
    cout << x << endl;
  }
  cout << cnt << endl;
}
