n,k=map(int,input().split())
a=[int(i) for i in input().split()]
sumi=0
for i in range(k):
  sumi+=a[i]
print(sumi)
#prasadbkd



6bbc6e5879b44ee71484e9ee5bc390b13f4000d1
<mask token>

<mask token>
for i in range(k):
    sumi += a[i]
print(sumi)

n, k = map(int, input().split())
a = [int(i) for i in input().split()]
sumi = 0
for i in range(k):
    sumi += a[i]
print(sumi)

n,k=map(int,input().split())
a=[int(i) for i in input().split()]
sumi=0
for i in range(k):
  sumi+=a[i]
print(sumi)
#prasadbkd


