#include <bits/stdc++.h>
int compare(const void *a, const void *b) { return *(int *)a - *(int *)b; }
int main() {
  int N, x, a[110], i, count = 0, sum = 0, subsum = 0;
  scanf("%d", &N);
  scanf("%d", &x);
  for (i = 0; i < N; i++) {
    scanf("%d", &a[i]);
    sum += a[i];
  }
  qsort(a, N, sizeof(int), compare);
  if (sum < x) {
    printf("\n%d\n\n", N - 1);
  } else if (sum >= x) {
    for (i = 0; i < N; i++) {
      if (x >= a[i]) {
        x -= a[i];
        count++;
      }
    }
    printf("\n%d\n\n", count);
  }
  return 0;
}
