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

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

a.sort()

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.sort()

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.sort()
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.sort()
ans = 0
for i in range(k):
    ans += p[i]
print(ans)

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