The Witchwood
题号:NC223806
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 1024 M,其他语言2048 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 . There are snack stalls in , the th of which gives him a_i pleasure.
Bob's stomach allows him to eat 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   and k , indicating the number of snack stalls and the capacity of Bob's stomach.
The second line of input contains integers , the th of which indicates the pleasure of the th snack stall.

输出描述:

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

输入

复制
5 2
9 8 10 2 4

输出

复制
19