The Witchwoods
题号:NC230838
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Shenyang's night fair culture is developed very well. Every time Bob comes to Shenyang, he will definitely go to a night fair called The Witchwood. There are n snack stalls in The Witchwood, the ith of which gives him a_i pleasure.

Bob's stomach allows him to eat k snack stalls at most. So Bob wants to know the maximum pleasure he can get after visiting the night market.

输入描述:

The first line of input contains two integers n  and k , indicating the number of snack stalls and the capacity of Bob's stomach.

The second line of input contains n integers , the ith of which indicates the pleasure of the ith snack stall.

输出描述:

Print one integer denoting the maximum pleasure Bob can get.
示例1

输入

复制
5 2
9 8 10 2 4

输出

复制
19