import numpy as np

import sys

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

l = sorted(list(map(int,input().split())))[::-1]

print((sum(l[:k])))

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

L = sorted(list(map(int,input().split())))[::-1]

print((sum(L[0:k])))
import numpy as np
import sys

n, k = list(map(int, input().split()))
l = sorted(list(map(int, input().split())))[::-1]
print((sum(l[:k])))

n, k = list(map(int, input().split()))
L = sorted(list(map(int, input().split())))[::-1]
print((sum(L[0:k])))

-import numpy as np -import sys - -l = sorted(list(map(int, input().split())))[::-1] -print((sum(l[:k]))) +L = sorted(list(map(int, input().split())))[::-1] +print((sum(L[0:k])))