<filename>contests_atcoder/abc171/abc171_b.py
n, k = map(int, input().split())
p = list(map(int, input().split()))

p.sort()

print(sum(p[:k]))
<filename>contests_atcoder/abc171/abc171_b.py
n, k = map(int, input().split())
p = list(map(int, input().split()))

p.sort()

print(sum(p[:k]))