#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, x;
  cin >> N >> x;
  int a[100];
  for (int i = 0; i < N; i++) {
    cin >> a.at(i);
  }
  
  sort(a, a + N, less<int>());
  
  int res = 0;
  int i = 0;
  while (x > 0) {
    if (x >= a[i]) {
      res++;
      x -= a[i];
      i++;
    }
  }
  
  cout << res << endl;
  
}