#C11077. Maximum Total Sweetness

    ID: 40353 Type: Default 1000ms 256MiB

Maximum Total Sweetness

Maximum Total Sweetness

You are given n types of candies and each candy has an associated sweetness level. You need to select exactly m candies such that the total sweetness is maximized. In other words, you should choose the m candies with the highest sweetness levels and output their sum.

Note: The input will contain the number of candy types n, the number of candies to choose m, followed by a list of n integers where each integer represents the sweetness level of a candy type.

The task is to compute and print the maximum total sweetness achieved by selecting exactly m candies.

The solution should read from standard input and output the answer to standard output.

inputFormat

The first line of input contains two integers n and m (1 ≤ m ≤ n) separated by a space.

The second line contains n space-separated integers representing the sweetness levels of the candies.

outputFormat

Output a single integer: the maximum total sweetness when selecting exactly m candies.

## sample
1 1
5
5

</p>