# main
(n, m) = map(int, input().split())
candy = [0 for _ in range(m)]
line = input().split()
for i in range(m):
candy[i] = int(line[i])
candy.sort(reverse = True)
print(sum(candy[0 : m]))
思路很简单,唔。。。50分
# main
(n, m) = map(int, input().split())
candy = [0 for _ in range(m)]
line = input().split()
for i in range(m):
candy[i] = int(line[i])
candy.sort(reverse = True)
print(sum(candy[0 : m]))
思路很简单,唔。。。50分