a, b = map(int, input().split())
l = sorted(list(map(int, input().split())))[::-1]
sum = 0
for i in range(b):
    sum += l[i]
print(sum)

59fe929405e865c580df5dad27d63ceddd4b45d4
<mask token>

<mask token>
for i in range(b):
    sum += l[i]
print(sum)

a, b = map(int, input().split())
l = sorted(list(map(int, input().split())))[::-1]
sum = 0
for i in range(b):
    sum += l[i]
print(sum)
