n,k = list(map(int, input().split()))

l = [int(i) for i in input().split()]

l.sort(reverse = True)

ans =0

for j in range(k):

  ans += l[j]

print(ans)
n,k = list(map(int,input().split()))

l = [int(_) for _ in input().split()]

l.sort(reverse=True)

print((sum(l[:k])))
n, k = list(map(int, input().split()))
l = [int(i) for i in input().split()]
l.sort(reverse=True)
ans = 0
for j in range(k):
    ans += l[j]
print(ans)

n, k = list(map(int, input().split()))
l = [int(_) for _ in input().split()]
l.sort(reverse=True)
print((sum(l[:k])))

-l = [int(i) for i in input().split()] +l = [int(_) for _ in input().split()] -ans = 0 -for j in range(k): -    ans += l[j] -print(ans) +print((sum(l[:k])))