#include <bits/stdc++.h>
using namespace std;
long long int N, x, a[111];
int main() {
  scanf("%lld%lld", &N, &x);
  for (int i = 1; i <= N; ++i) {
    scanf("%lld", a + i);
  }
  a[N + 1] = max(x, *max_element(a, a + N + 1));
  sort(a, a + N + 2);
  partial_sum(a, a + N + 2, a);
  printf("%lu\n", upper_bound(a, a + N + 1, x) - a - 1);
  return 0;
}
