let L = Int(readLine()!)! let N = Int(readLine()!)! var W = readLine()!.split(separator: " ").map{Int($0)!} W += [L] W.sort() var sum :Int = 0 var count :Int = 0 while sum < L{ sum = sum + W[count] count = count + 1 } if sum > L{ count = count - 1 } print(count)