#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, x;
  int a[110];
  cin >> N >> x;
  for (int i = 0; i < N; i++) cin >> a[i];
  int count = 0;
  sort(a, a + N);
  int idx = 0;
  while (x > 0) {
    idx = idx % N;
    x -= a[idx];
    if (x >= 0) count++;
    idx++;
  }
  cout << count << endl;
  return 0;
}
