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