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

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

p = sorted(p)

ans = 0

for i in range(k):

    ans += p[i]

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

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



A = sorted(A)

ans = 0

for i in range(k):

    ans += A[i]

print(ans)
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
p = sorted(p)
ans = 0
for i in range(k):
    ans += p[i]
print(ans)

n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
A = sorted(A)
ans = 0
for i in range(k):
    ans += A[i]
print(ans)

-p = list(map(int, input().split())) -p = sorted(p) +A = list(map(int, input().split())) +A = sorted(A) -    ans += p[i] +    ans += A[i]