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

int main(void){
    int n,x,b=0;
    cin >> n >> x;
    vector<int> a(n),c(n);
    for(int i = 0;i < n;i++)cin >> a[i];
    sort(a.begin(),a.end());
    for(int i = 0;i < n;i++){
        if(a[i] <= x)c[i] = a[i];
        else c[i] = 0;
        x -= a[i];
    }
    c[n-1] += x
    for(int i = 0;i < n;i++){
        if(a[i] == c[i])b++;
    }
    cout << b << endl;
}