#include #include #include #include #include #include #include #define rep(i,n) for(int i=0;i pii; int main(void) { int a,b,c; std::priority_queue pq; cin>>a>>b; rep(i,b)cin>>c,pq.push(c); int k=0; int z=0; while(!pq.empty()){ int t=pq.top(); if(t+z>a)break; z+=t; k++; } cout<