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