#include <bits/stdc++.h>
using namespace std;
int comp(const void *c1, const void *c2);
int main() {
  int n, x;
  cin >> n >> x;
  int a[100];
  int all = 0;
  for (int i = 0; i != n; i++) {
    cin >> a[i];
    all = all + a[i];
  }
  if (all == x) {
    cout << n << '\n';
    return 0;
  } else if (all < x) {
    cout << n - 1 << '\n';
    return 0;
  }
  qsort(a, n, sizeof(int), comp);
  for (int i = 0; i != n; i++) {
    cout << a[i] << ' ';
  }
  cout << '\n';
  int ans = 0;
  int c = 0;
  for (int i = 0; i != n; i++) {
    c = c + a[i];
    if (x - c < 0) {
      cout << i + 1 << '\n';
      break;
    }
  }
  return 0;
}
int comp(const void *c1, const void *c2) {
  int tmp1 = *(int *)c1;
  int tmp2 = *(int *)c2;
  if (tmp1 < tmp2) return -1;
  if (tmp1 == tmp2) return 0;
  if (tmp1 > tmp2) return 1;
}
