fun main(args: Array){ val boxWidth = readLine()!!.toInt() val blockCount = readLine()!!.toInt() val blockList = readLine()!!.split(" ").map { it.toInt() }.sorted() if(boxWidth >= blockList.sum()) { println(blockCount) return } var total = 0 for(i in blockList.indices) { total += blockList[i] if(total > boxWidth) { println(i) break } } }