#include #include #include #include #include #include #include #include #include #include #include #include #include #define ld long double #define ll long long int #define ull unsigned long long int #define rep(i,n) for(i=0;i inline bool chmax(T& a,T b){if(a inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;} const long long LLINF=1LL<<60; //set::iterator it; int main(void){ios::sync_with_stdio(false);cin.tie(0); ////////////////////////////////////////////////////// int x,ans=0,n,i; cin>>x>>n; int a[n]; rep(i,n)cin>>a[i]; sort(a,a+n); for(i=0;i=a[i]){ x-=a[i]; ans++; } else break; } cout<