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

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

print((sum(p[:k])))
import sys

input = lambda: sys.stdin.readline().rstrip()



def main():

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

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

    print((sum(p[:k])))





if __name__ == '__main__':

    main()
n, k = list(map(int, input().split()))
p = sorted(list(map(int, input().split())))
print((sum(p[:k])))

import sys

input = lambda: sys.stdin.readline().rstrip()


def main():
    n, k = list(map(int, input().split()))
    p = sorted(list(map(int, input().split())))
    print((sum(p[:k])))


if __name__ == "__main__":
    main()

-n, k = list(map(int, input().split())) -p = sorted(list(map(int, input().split()))) -print((sum(p[:k]))) +import sys + +input = lambda: sys.stdin.readline().rstrip() + + +def main(): +    n, k = list(map(int, input().split())) +    p = sorted(list(map(int, input().split()))) +    print((sum(p[:k]))) + + +if __name__ == "__main__": +    main()