#include using namespace std; typedef long long ll; typedef pair P; ll l,n,w[10005]; ll ans; int main(void){ cin>>l>>n; for(int i=0;i>w[i]; } sort(w,w+n); ll i=0; while(l>=0){ ans++; l-=w[i]; i++; } cout<