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