fun main( args : Array ) { var l = readLine()!!.toInt() val n = readLine()!!.toInt() var cnt = 0 for( s in readLine()!!.split(" ").map { it.toInt() }.sorted() ) { l -= s cnt += 1 if( l < 0 ) break } println( cnt-1 ) }