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

l = list(map(int, input().split()))

l.sort(reverse = True)



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

ll = list(map(int, input().split()))

ll.sort()

print((sum(ll[len(ll)-k:])))
n, k = list(map(int, input().split()))
l = list(map(int, input().split()))
l.sort(reverse=True)
print((sum(l[:k])))

n, k = list(map(int, input().split()))
ll = list(map(int, input().split()))
ll.sort()
print((sum(ll[len(ll) - k :])))

-l = list(map(int, input().split())) -l.sort(reverse=True) -print((sum(l[:k]))) +ll = list(map(int, input().split())) +ll.sort() +print((sum(ll[len(ll) - k :])))