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