For this Question: You are given an array <b>A</b> of size N, and an integer x = 0. In one move, you can choose two indices i and j such that i < j and add the maximum of these integers from the two to x. And finally, delete that bigger number from the array. If both elements are equal you can remove any of the two and add that value to x.
After performing this operation a maximum of K times, find the maximum possible value of x you can get.First line of the input contains two integers, N and K.
The second line of the input contains N space seperated integers.

Constraints:
1 <= K < N <= 10<sup>5</sup>
1 <= A<sub>i</sub> <= 10<sup>9</sup>Print the maximum possible value of x you can get.Sample Input:
5 2
5 6 4 2 3

Sample Output:
11

Explanation:
In the first move, we choose i = 1 and j = 3. We get the max value of these as 5, and then we add it to x and remove it from the array. x = 5, A = [6, 4, 2, 3]
In the next and final move, we again choose indices i = 1, j = 3. Updated x = 11, A = [4, 2, 3], I have written this Solution Code: N,K = map(int,input().split())
arr = list(map(int,input().split()))

soArr = sorted(arr)

sum1 = 0

for i in range(1,K+1):
    sum1 += soArr[-i]

print(sum1), In this Programming Language: Python, Now tell me if this Code is compilable or not?