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

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



count = 0

result = []

while count < a[1]:

  result.append(min(b))

  b.remove(min(b))

  count += 1

  

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

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

ans = 0

for _ in range(k):

  m = min(p)

  ans += m

  p.remove(m)

  

print(ans)
a = list(map(int, input().split()))
b = list(map(int, input().split()))
count = 0
result = []
while count < a[1]:
    result.append(min(b))
    b.remove(min(b))
    count += 1
print((sum(result)))

n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
ans = 0
for _ in range(k):
    m = min(p)
    ans += m
    p.remove(m)
print(ans)

-a = list(map(int, input().split())) -b = list(map(int, input().split())) -count = 0 -result = [] -while count < a[1]: -    result.append(min(b)) -    b.remove(min(b)) -    count += 1 -print((sum(result))) +n, k = list(map(int, input().split())) +p = list(map(int, input().split())) +ans = 0 +for _ in range(k): +    m = min(p) +    ans += m +    p.remove(m) +print(ans)