func main() var l: int :: cui@inputInt() var n: int :: cui@inputInt() var w: []int :: #[n]int for i(0, n - 1) do w[i] :: cui@inputInt() end for do w.sort() var sum: int for i(0, n - 1) do sum :+ w[i] if(sum > l) do cui@print("\{i}\n") ret end if end for do cui@print("\{n}\n") end func