NK = input().split()

n = int(NK[0])

k = int(NK[1])

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

arr.sort()

print((sum(arr[0:k])))

n, k = input().split()

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

p = sorted(p)

ans = 0

for i in range(int(k)):

    ans += p[i]

print(ans)

NK = input().split()
n = int(NK[0])
k = int(NK[1])
arr = list(map(int, input().split()))
arr.sort()
print((sum(arr[0:k])))

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

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