Problem:
 Score : 200 points    Problem Statement Snuke has N sticks.
The length of the i -th stick is l_i .  Snuke is making a snake toy by joining K of the sticks together.  The length of the toy is represented by the sum of the individual sticks that compose it.
Find the maximum possible length of the toy.      Constraints  1 \leq K \leq N \leq 50  1 \leq l_i \leq 50  l_i is an integer.         Input Input is given from Standard Input in the following format:  N  K  l_1  l_2  l_3  ...  l_{N}       Output Print the answer.        Sample Input 1 5 3
1 2 3 4 5      Sample Output 1 12  You can make a toy of length 12 by joining the sticks of lengths 3 , 4 and 5 , which is the maximum possible length.       Sample Input 2 15 14
50 26 27 21 41 7 42 35 7 5 5 36 39 1 45      Sample Output 2 386

Solution (Python):
n,k = map(int, input().split())
l = sorted(list(map(int, input().split())), reverse=True)
print(sum(l[0:k]))

Solution (Python):
n,k=map(int,input().split())
l=sorted(list(map(int,input().split())),reverse=True)
print(sum(l[:k]))

Solution (Python):
N, K = map(int, input().split())
l = list(map(int, input().split()))
l.sort(reverse=True)

print(sum(l[:K]))

Solution (Python):
n, k = map(int, input().split())
l = list(map(int, input().split()))

l.sort(reverse=True)
print(sum(l[:k]))

Solution (Python):
n,k=map(int,input().split())
L=[int(i) for i in input().split()]

L.sort(reverse=True)
print(sum(L[:k]))

Solution (Python):
n, k = map(int, input().split())
lis = list(map(int, input().split()))

lis = sorted(lis, reverse = True)

ans = 0
for i in range(k):
    ans += lis[i]
    
print(ans)

Solution (Python):
n,k = map(int,input().split())
L = list(map(int,input().split()))
L = sorted(L,reverse=True)
print(sum(L[:k]))

Solution (Python):
n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort(reverse=True)
L=0
for i in range(0,k):
    L+=l[i]


print(L)

Solution (Python):
import sys
input = sys.stdin.readline

n,k=list(map(int,input().split()))
l=sorted(list(map(int,input().split())),reverse=1)
print(sum(l[:k]))

Solution (Python):
n, k = map(int, input().split())
a = [int(i) for i in input().split()]
a.sort(reverse=True)
c = 0
for i in range(k):
    c += a[i]
print(c)

Solution (Python):
N,K = map(int,input().split())
lst = list(map(int,input().split()))

lst.sort(reverse=True)
print(sum(lst[:K]))

Solution (Python):
n,k = map(int,input().split())
li = list(map(int,input().split()))
lia = sorted(li, reverse=True)
a = 0
for i in range(k):
    a += lia[i]
print(a)

Solution (Python):
N,K = map(int,input().split())
L = sorted(list(map(int,input().split())))
L = L[::-1]

print(sum(L[:K]))

Solution (Python):
n, k = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
print((sum(l[-1*k:])))

Solution (Python):
n,k=map(int,input().split())
print(sum(sorted(list(map(int,input().split())),reverse=True)[:k]))

Solution (Python):
n,k=map(int,input().split())
lst=sorted(map(int,input().split()))

print(sum(lst[:-k-1:-1]))

Solution (Python):

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

print(sum(l[n - k :]))

Solution (Python):
N, K = map(int, input().split())
l = list(map(int, input().split()))
l.sort(reverse=True)
print(sum(l[:K]))

Solution (Python):
n, k = map(int, input().split())
lst = sorted(list(map(int, input().split())), reverse=True)
print(sum(lst[:k]))

Solution (Python):
n, k = map(int, input().split())
L = sorted(list(map(int, input().split())), reverse=True)
print(sum(L[:k]))

Solution (Python):
N, K = map(int, input().split())
print(sum(sorted(map(int, input().split()), reverse = True)[:K]))

Solution (Python):
n, k = map(int, input().split())
l = list(map(int, input().split()))
result = 0
l.sort(reverse=True)
for i in range(k):
    result += l[i]
print(result)

Solution (Python):
N, K = map(int,input().split())
L = list(map(int,input().split()))
L = sorted(L)[::-1]
s = 0
for i in range(K):
    s += L[i]
print(s)

Solution (Python):
N,K = map(int,input().split())
l = [int(x) for x in input().split()]
ans = 0
for _ in range(K):
    m = max(l)
    ans += m
    m_i = l.index(m)
    l[m_i]=0

print(ans)

Solution (Python):
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

N,K = I()
L = l()
L.sort(reverse=True)
print(sum(L[:K]))

Solution (Python):
n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
print(sum(l[n-k:]))

Solution (Python):
data = [int(i) for i in input().split(' ')]
K = data[1]
ls = sorted([int(i) for i in input().split(' ')], reverse=True)

l_sum = 0
for k in range(K):
    l = ls[k]
    l_sum += l

print(l_sum)

Solution (Python):
n, k = map(int, input().split())
l = list(map(int, input().split()))
l.sort(reverse=True)
print(sum(l[:k]))

Solution (Python):
n, k = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
print(sum(arr[-k:]))

Solution (Python):
n, k = map(int, input().split())
l = sorted(map(int, input().split()))
print(sum(l[n-k:]))

Solution (Python):
n, k = map(int, input().split())
l = sorted(map(int, input().split()))

ans = sum(l[n - k:])
print(ans)

Solution (Python):
def solve():
    N, K = map(int, input().split())
    L = [int(i) for i in input().split()]
    L.sort(reverse = True)
    print(sum(L[:K]))


if __name__ == "__main__":
    solve()

Solution (Python):
i = list(map(int, input().split()))
N = i[0]
K = i[1]
l = list(map(int, input().split()))

l.sort(reverse=True)
l = l[0:K]
print(sum(l))

Solution (Python):
n,k = map(int, input().split())
l=list(map(int, input().split()))

list.sort(l,reverse=True)
a=0
for i in range(k):
   a=a+l[i]
   
   
print(a)

Solution (Python):
n,k = map(int,input().split())
print(sum(sorted(map(int,input().split()))[n-k:]))

Solution (Python):
n, k = map(int, input().split())
print(sum(sorted(map(int, input().split()))[n-k:]))

Solution (Python):
N, K = map(int, input().split())
L = list(map(int, input().split()))
sorted_L = sorted(L, reverse=True)
print(sum(sorted_L[:K]))

Solution (Python):
n, k = map(int, input().split())
l = sorted(map(int, input().split()))[::-1]
print(sum(l[:k]))

Solution (Python):
N , K  = map(int,input().split())
l = [int(x) for x in input().split()]
l = sorted(l)
猫 = 100

l.reverse()
for i in range(K):
  猫 += l[i]
print(猫-100)

Solution (Python):
n,k=[int(i) for i in input().split()]
l_list=[int(i) for i in input().split()]

l_list.sort(reverse=True)

new_list=l_list[:k]
print(sum(new_list))

Solution (Python):
n,k = map(int, input().split())
l = sorted(list(map(int, input().split())), reverse=True)

print(sum(l[:k]))

Solution (Python):


N, K = map(int, input().split())
l = sorted(list(map(int, input().split())), reverse=True)

print(sum(l[0:K]))

Solution (Python):
N, K = map(int, input().split())
l = list(map(int, input().split()))
l.sort(reverse=True)
print(sum(l[:K]))

Solution (Python):
N,K=map(int,input().split())
l=list(map(int,input().split()))
l.sort(reverse=True)
ans=0
for i in range(K):
    ans+=l[i]
print(ans)

Solution (Python):

N, K = map(int, input().split())
L = sorted(list(map(int, input().split())))
ans = sum(L[-K:N])
print(ans)

Solution (Python):
n, k = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
l.reverse()
print(sum(l[:k]))

Solution (Python):
n,k = map(int,input().split())
L = list(map(int,input().split()))
L.sort(reverse=True)
ans = sum(L[0:k])
print(ans)

Solution (Python):
N,K = map(int, input().split())
length = list(map(int, input().split()))

a = sorted(length, reverse=True)
b = a[0:K]
print(sum(b))

Solution (Python):
n,k=map(int, input().split())
l=list(map(int, input().split()))
l.sort(reverse=True)
length=0
for i in range(k):
  length+=l[i]
print(length)

Solution (Python):
N,K=map(int,input().split())
l=list(map(int,input().split()))
print(sum(sorted(l)[::-1][:K]))

Solution (Python):
n, k = map(int, input().split())
l = list(map(int, input().split()))

print(sum(sorted(l)[-k:]))

Solution (Python):
N, K = map(int, input().split())
l = [int(i) for i in input().split()]
a = 0
l.sort(reverse=True)
for i in range(K):
    a += l[i]
print(a)

Solution (Python):
N, K = map(int, input().split())
L = sorted(list(map(int, input().split())), reverse=True)
print(sum(L[:K]))

Solution (Python):
N,K=map(int,input().split())
l=list(map(int,input().split()))
l.sort(reverse=True)
print(sum(l[:K]))

Solution (Python):
n, k = map(int, input().split())
apple = list(map(int, input().split()))
print(sum(sorted(apple)[::-1][:k]))

Solution (Python):
N, K = map(int, input().split())
l = list(map(int,input().split()))

l.sort(reverse=True)

snake = 0

for i in range(K):
  snake = snake + l[i]

print(snake)

Solution (Python):
n,k = map(int,input().split())
l = list(map(int,input().split()))
l = sorted(l,reverse=True)
print(sum(l[:k]))

Solution (Python):
import sys
N,K = map(int,input().split())
int_array = list(map(int,input().split()))

if N < 0 or K < 0 or N > 50 or K > 50:
    sys.exit()
for I in int_array:
    if I > 50:
        sys.exit()

rev_sort_int_array = sorted(int_array,reverse=True)
result = 0
for J in range(K):
    result += rev_sort_int_array[J]

print(result)

Solution (Python):
def main():
  n,k = list(map(int,input().split()))
  l = list(map(int,input().split()))
  l.sort(reverse=True)
  sum=l[0]
  for i in range(1,k):
    sum+=l[i]
  print(sum)
    
main()

Solution (Python):
N,K = map(int,input().split())
print(sum(sorted(list(map(int,input().split())))[-K:]))

Solution (Python):
N, K = map(int, input().split())
l = list(map(int, input().split()))
x = sorted(l)[::-1]
print(sum(x[:K]))

Solution (Python):
import math

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def main():
    N, K = mi()
    l = list(mi())
    l.sort(reverse=True)
    print(sum(l[:K]))

if __name__ == '__main__':
    main()

Solution (Python):
n, k = map(int, input().split())
L = sorted(list(map(int, input().split())), reverse=True)
print(sum(L[:k]))

Solution (Python):
n,k = input().split()
list_in = list(map(int,input().split()))
list_in.sort(reverse = True)
sum = 0
for i in range(int(k)):
  sum = sum+list_in[i]
print(sum)

Solution (Python):
n,k = map(int, input().split())
l = sorted(list(map(int, input().split())))
print(sum(l[-k:]))

Solution (Python):
n, k = map(int, input().split())
l = list(map(int, input().split()))
l.sort(reverse = True)
ans = 0
for i in range(k):
  ans += l[i]
print(ans)

Solution (Python):
N, K = map(int, input().split())
l = list(map(int, input().split()))
l.sort(reverse=True)

print(sum(l[0:K]))

Solution (Python):
N, K = map(int, input().split())
l = list(map(int, input().split()))

l = sorted(l, reverse = True)

print(sum(l[:K]))

Solution (Python):
N,K = map(int,input().split())

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


l_sort = sorted(l, reverse=True)


a =0
for i in range(K):
    a += l_sort[i]
print(a)

Solution (Python):
[N, K] = list(map(int, input().split()))
List_l = list(map(int, input().split()))
List_l.sort(reverse = True)
print(sum(List_l[0:K]))

Solution (Python):
N, K = map(int, input().split())
L = list(map(int, input().split()))

print(sum(sorted(L, reverse=True)[:K]))

Solution (Python):
N,K=map(int,input().split());l=sorted(map(int,input().split()));print(sum(l[-K:]))

Solution (Python):
def resolve():
    n, k = map(int, input().split())
    length = list(map(int, input().split()))
    list.sort(length, reverse=True)

    ans = 0
    for i in range(k):
        ans += length[i]
    print(ans)
resolve()

Solution (Python):
n,k=map(int,input().split())
a=list(map(int, input().split()))
b=sorted(a,reverse=True)
print(sum(b[:k]))

Solution (Python):
N, K = list(map(int, input().strip().split()))
ls = list(map(int, input().strip().split()))

ls = sorted(ls, reverse = True)
print(sum(ls[:K]))

Solution (Python):
from itertools import combinations

N, K = map(int, input().split())
L = sorted(list(map(int, input().split())), reverse=True)
ans = sum(L[:K])
print(ans)

Solution (Python):
n, k = map(int, input().split())
l = list(map(int,input().split()))
l.sort(reverse=True)
sum = 0
for i in range(k):
	sum += l[i]
print(sum)

Solution (Python):
n,k = map(int,input().split())
l = list(map(int,input().split()))

l.sort(reverse = True)
ans = 0

for i in range(k):
    ans += l[i]

print(ans)

Solution (Python):
n, k = map(int, input().split())
l = list(map(int, input().split()))
l = sorted(l)[::-1]
sum = 0
for i in range(k):
    sum += l[i]
print(sum)

Solution (Python):
n,k = (map(int,input().split()))
l = list(map(int,input().split()))
l.sort()
l.reverse()
ans=0
for i in l[:k]:
    ans +=i
print(ans)

Solution (Python):
n,k = map(int,input().split())
l = list(map(int,input().split()))
list.sort(l,reverse = True)
c = 0

for i in range(k):
    c = c + l[i]

print(c)

Solution (Python):
n,k = map(int,input().split())
l = list(map(int,input().split()))

l.sort(reverse = True)

print(sum(l[:k]))

Solution (Python):
N,K=map(int,input().split())
l=list(map(int,input().split()))
check=sorted(l,reverse=True)
ans=0
for i in range(0,K):
  ans+=check[i]
print(ans)

Solution (Python):
N, K = map(int, input().split())
L = sorted(list(map(int, input().split())), reverse=True)

print(sum(L[:K]))

Solution (Python):
n, k = map(int, input().split())
l = list(map(int, input().split()))
l = sorted(l, reverse=True)
result = 0
for i in range(k):
    result += l[i]
print(result)

Solution (Python):
n, k = map(int, input().split())
l = list(map(int, input().split()))
a = 0
	
l.sort(reverse = True)

for i in range(k):
	a += l[i]
	
print(a)

Solution (Python):
n, k = map(int, input().split())
l = list(map(int, input().split()))
L = sorted(l, reverse=True)
a = 0
for i in range(k):
  a = a + L[i]
print(a)

Solution (Python):
n,k=map(int,input().split())
l=list(map(int,input().split()))
l=sorted(l,reverse=True)
x=0
for j in range(k):
    x+=l[j]
print(x)

Solution (Python):
def calclength(N, K, length) :
  length.sort(reverse = True)
  lengthsum = 0
  for i in range(K) : 
    lengthsum += length[i]
    
  return lengthsum

N, K = tuple(map(int, input().split()))

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

print(calclength(N, K, length))

Solution (Python):
n,k = list(map(int,input().strip().split()))
a = list(map(int,input().strip().split()))
a.sort(reverse=True)

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

Solution (Python):
n,k=map(int,input().split())
a=[0]*n
b=[0]*k
a=list(map(int,input().split()))
a=sorted(a,reverse=True)
b=a[:k]
print(sum(b))

Solution (Python):
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
print(sum(a[n-k:]))

Solution (Python):

N,K = map(int,input().split())
L =[int(i) for i in input().split()]
L.sort(reverse=True)
ans = sum(L[:K])
print(ans)

Solution (Python):

N,K = map(int,input().split())
L =[int(i) for i in input().split()]
L.sort(reverse=True)
ans = sum(L[:K])
print(ans)

Solution (Python):
n,k = map(int, input().split())

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

L.sort()
L.reverse()
ans = 0
for i in range(0,k):
  ans += L[i]
  
print(ans)

Solution (Python):
N, K = map(int, input().split())
L = list(map(int, input().split()))
L.sort(reverse=True)
print(sum(L[:K]))

Solution (Python):
def resolve():
    N, K = map(int, input().split())
    long = list(map(int, input().split()))
    L = sorted(long)[K*-1:]
    print(sum(L))
resolve()

Solution (Python):
n, k = map(int, input().split())
L = list(map(int, input().split()))
L.sort(reverse=True)
ans = 0
for i in range(k):
    ans += L[i]
print(ans)

Solution (Python):
n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse = True)
print(sum(a[0:k]))

Solution (Python):
N,K = map(int, input().split())
L = list(map(int, input().split()))
L.sort(reverse=True)
print(sum(L[:K]))

Solution (Python):
n, k = map(int, input().split())
l = sorted([int(i) for i in input().split()], reverse=True)
print(sum(l[:k]))

Solution (Python):
N, K = map(int, input().split())
ls = list(map(int, input().split()))
ans = 0

for i in range(K):
  M = max(ls)
  index = ls.index(M)
  ls[index] = 0
  ans+= M
  
print(ans)

Solution (Python):
n,m=map(int, input().split(" "))
s= sorted(list(map(int, input().split(" "))))
print(sum(s[n-m:]))

Solution (Python):
n,k = map(int,input().split())
l = list(map(int,input().split()))
l.sort()
l.reverse()
ans = 0
for i in range(k):
    ans += l[i]
print(ans)

Solution (Python):
n,k=map(int,input().split())
a=list(map(int, input().split()))
l=0
for i in range(k):
  l+=max(a)
  a.remove(max(a))

print(l)

Solution (Python):
N, K = map(int, input().split())
l = list(map(int, input().split()))

l.sort(reverse=True)
print(sum(l[:K]))

Solution (Python):
n, k = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
print(sum(arr[n - k:]))

Solution (Python):
N, K = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
print(sum(A[:K]))

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

Solution (Python):
def main():
    n,k = map(int,input().split())
    a_list = list(map(int, input().split()))
    ans = 0

    a_list.sort(reverse=True)
    for i in range(k):
        ans += a_list[i]

    return ans

print(main())

Solution (Python):
N, K = map(int, input().split())
L = list(map(int, input().split()))

L.sort(reverse=True)
print(sum(L[:K]))

Solution (Python):
n,k=map(int,input().split())
List=list(map(int,input().split()))
List.sort(reverse=True)
print(sum(List[:k]))

Solution (Python):
n, k = map(int, input().split())
L = list(map(int, input().split()))

L.sort()
ans = sum(L[-k:])
print(ans)

Solution (Python):
n, k = map(int, input().split())
l = list(map(int, input().split()))
l = sorted(l, reverse=True)
print(sum(l[:k]))

Solution (Python):
def main():
    N, K = map(int,input().split())
    a = list(map(int,input().split()))
    a.sort(reverse=True)
    ans = sum(a[:K])
    print(ans)
    return
main()

Solution (Python):
n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort(reverse=True)
print(sum(l[:k]))

Solution (Python):
N, K= list(map(int, input().split())) 
l = list(map(int, input().split()))

print(sum(sorted(l)[-K:]))

Solution (Python):
N ,K = map(int,input().split())
li   =list(map(int,input().split()))
ans = 0
li.sort()
for l in li[N-K:N]:
    ans = ans + int(l)
print(str(ans))

Solution (Python):
N, K =map(int, input().split())
l = list(map(int, input().split()))

l = sorted(l)[::-1]
ans = 0
for i in range(K):
  ans += l[i]

print(ans)

Solution (Python):
n, k = list(map(int, input().split())) 
argList = list(map(int, input().split())) 
argList.sort()
print(sum(argList[n-k:]))

Solution (Python):
n, k = map(int, input().split())
l = list(map(int, input().split()))
print(sum(sorted(l)[-k:]))

Solution (Python):

if __name__ == '__main__':
    b, c = map(int, input().split())
    a = [int(i) for i in input().split()]

    a.sort(reverse=True)
    count = 0
    for i in range(c):
        count+=a[i]
    print(count)

Solution (Python):
N, K = map(int, input().split())
l = list(map(int, input().split()))

l = sorted(l)[::-1]
print(sum(l[0:K]))

Solution (Python):
N,K=map(int,input().split())
L=list(map(int,input().split()))
L.sort(reverse=True)
ans=sum(L[:K])
print(ans)

Solution (Python):
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

N, K = map(int, input().split())
A = list(map(int, input().split()))

A.sort(reverse=True)

print(sum(A[:K]))

Solution (Python):
N, K = map(int, input().split())
L = [int(l) for l in input().split()]
L.sort(reverse = True)
print(sum(L[:K]))

Solution (Python):
n, k = map(int, input().split())
l = list(map(int, input().split()))

l.sort(reverse=True)

print(sum(l[:k]))

Solution (Python):
N, K = map(int, input().split())
*l, = map(int, input().split())
l.sort(key=lambda x: -x)
print(sum(l[:K]))

Solution (Python):
n, k = map(int, input().split())
L = sorted([int(i) for i in input().split()], reverse = True)
print(sum(L[: k]))

Solution (Python):
a, b = map(int, input().split())
length = map(int, input().split())
length = sorted(length, reverse=True)

print(sum(length[:b]))

Solution (Python):
n, k = map(int, input().split())

a = sorted(list(map(int, input().split())),reverse=True)

print(sum(a[:k]))

Solution (Python):

n, k = map(int, input().split())
L = list(map(int, input().split()))
L.sort(reverse=True)
print(sum(L[:k]))

Solution (Python):
n, k = map(int, input().split())
print(sum(sorted(list(map(int, input().split())))[-k:]))

Solution (Python):
n,k = map(int,input().split())
l = list(map(int,input().split()))

l.sort(reverse = True)

print(sum(l[:k]))

Solution (Python):
N,K = map(int,input().split())
l = list(map(int,input().split()))
len_num = 0

l.sort(reverse=True)

for i in range(K):
    len_num += l[i]
print(len_num)

Solution (Python):
n, k = map(int, input().split())
l = list(map(int, input().split()))

l.sort(reverse=True)
print(sum(l[:k]))

Solution (Python):
n,k=map(int,input().split())
l=list(map(int,input().split()))
L=sorted(l)[::-1]
print(sum(L[:k]))

Solution (Python):
N, K = map(int, input().split())
a = list(map(int, input().split()))
max = 0
a.sort(reverse=True)
for i in a[0:K]:
  max += i
print(max)

Solution (Python):
N,K = map(int,input().split())
L = sorted(list(map(int,input().split())))
print(sum(L[N-K:]))

Solution (Python):
n,k = map(int, input().split())
al = list(map(int, input().split()))

als = sorted(al)
rl = als[n-k:]
print(sum(rl))

Solution (Python):
N, K = map(int, input().split())
l = sorted(list(map(int, input().split())), reverse=True)
print(sum(l[:K]))

Solution (Python):
N,K= map(int, input().split())
l = input().split()
l=[int(s) for s in l]
l.sort()
sum=0
for i in range(K):
	sum+=l[N-i-1]
print(sum)

Solution (Python):
n,k=map(int,input().split())
print(sum(sorted(map(int,input().split()))[-k:]))

Solution (Python):
N,K = map(int,input().split())
l = sorted(list(map(int,input().split())),reverse=True)

print(sum(l[:K]))

Solution (Python):
import sys

sys.setrecursionlimit(10000000)
import os
import math
import bisect
import collections
import itertools
import heapq
import re
import queue



ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)


MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, K = il()
    L = sorted(il(), reverse=True)
    print(sum(L[:K]))


if __name__ == '__main__':
    main()

Solution (Python):
N, K = map(int, input().split())
l = list(map(int, input().split()))

l.sort()

ans = 0
for i in range(K):
    ans += l[-i-1]
print(ans)

Solution (Python):
N, K = (int(i) for i in input().split())
l = [int(i) for i in input().split()]

l.sort()
ans = 0
for i in range(1, K+1):
    ans += l[-i]
print(ans)

Solution (Python):
N, K = map(int, input().split())
L = list(map(int, input().split()))
ans = 0

L = sorted(L, reverse=True)

for i in range(0, K, 1):
    ans += L[i]

print(ans)

Solution (Python):
def main():
    n,k = list(map(int, input().split()))
    t = list(map(int, input().split()))
    t.sort()
    print(sum(t) - sum(t[:n-k]))

if __name__ == '__main__':
    main()

Solution (Python):
n,k = map(int,input().split())
l = list(map(int,input().split()))




l = sorted(l)[-k:]

print(sum(l))

Solution (Python):
n, k = map(int, input().split())
l = list(map(int, input().split()))

l.sort(reverse=True)
ans = 0
for i in range(k):
    ans += l[i]
print(ans)

Solution (Python):
N, K = map(int, input().split())
l = list(map(int, input().split()))
l.sort(reverse=True)
result = 0
for i in range(K):
    result += l[i]
print(result)

Solution (Python):
n,k = list(map(int, input().split()))
l = sorted(list(map(int, input().split())),reverse=True)

print(sum(l[:k]))

Solution (Python):

N, K = map(int, input().split())
bo = sorted(list(map(int, input().split())), reverse=True)
print(sum(bo[:K]))

Solution (Python):
N,K=map(int,input().split())
l=sorted(list(map(int,input().split())),reverse=True)
ans=0
for i in range(K) :
    ans+=l[i]
print(ans)

Solution (Python):
N, K = map(int, input().split())

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

loops.sort(reverse=True)

ans = sum(loops[:K])
print(ans)

Solution (Python):
a,b=map(int,input().split())
h=list(map(int,input().split()))
h.sort()
print(sum(h[-b:]))

Solution (Python):
N,M=list(map(int,input().split()))
l=list(map(int,input().split()))
l.sort(reverse=True)
print(sum(l[:M]))

Solution (Python):
n, k = list(map(int, input().split()))
L = list(map(int, input().split()))
print(sum(sorted(L, reverse = True)[:k]))

Solution (Python):
n, k = map(int, input().split())
l = list(map(int, input().split()))

l = sorted(l, reverse=True)
print(sum(l[0:k]))

Solution (Python):
n,k = map(int,input().split())
l = list(map(int,input().split()))
l.sort(reverse = True)
print(sum(l[:k]))

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]


def Yes(): print("Yes"); return
def No(): print("No"); return


def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def Base_10_to_n(X, n):
  if X//n:
    return Base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def Base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count





N,K = inputIL()
l = inputIL()

l.sort(reverse = True)

print(sum(l[:K]))

Solution (Python):
n, k = map(int, input().split())
l = sorted(list(map(int, input().split())))

print(sum(l[-k:]))

Solution (Python):
N,K = map(int,input().split())
l=list(map(int,input().split()))
l.sort(reverse=True)
print(sum(l[:K]))

Solution (Python):
n, k = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort(reverse=True)
ans = 0
for i in range(0, k):
    ans+=arr[i]
print(ans)

Solution (Python):
n,m=map(int,input().split())
a=sorted([int(i) for i in input().split()])
print(sum(a[-m:]))

Solution (Python):
N, K = map(int, input().split())
length = sorted(map(int, input().split()), reverse=True)
print(sum(length[:K]))

Solution (Python):
n, k = map(int , input().split())
l = list(map(int, input().split()))

l.sort(reverse=True)
s = l[:k]
print(sum(s))

Solution (Python):
N,K=map(int, input().split())
L=list(map(int, input().split()))
print(sum(sorted(L)[-K:]))

Solution (Python):
N,K = map(int, input().split())
l = list(map(int, input().split()))
l = sorted(l, reverse = True)
res = 0
for i in range(K):
    res += l[i]
print(res)

Solution (Python):
n,k = map(int,input().split())
l_list = list(map(int,input().split()))
l_list.sort(reverse=1)
print(sum(l_list[0:k]))

Solution (Python):
n, k = map(int, input().split())
list = list(map(int, input().split()))
sorted_list = sorted(list, reverse=True)
print(sum(sorted_list[:k]))

Solution (Python):
n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort(reverse=True)
s=0
for i in range(0,k):
  s=s+l[i]
print(s)

Solution (Python):
N,K = map(int,input().split()) 
l = list(map(int,input().split()))
l.sort(reverse = True)
length = 0
for i in range(K): 
    length += l[i]
print(length)

Solution (Python):
import sys
input = sys.stdin.readline

N, K = map(int, input().rstrip().split())
sticks = list(map(int, input().rstrip().split()))

sorted_sticks = sorted(sticks, reverse=True)
print(sum(sorted_sticks[:K]))

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N,K=map(int,input().split())
    l=list(map(int,input().split()))
    l.sort()
    print(sum(l[-K:]))

if __name__ == '__main__':
    main()

Solution (Python):
n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort(reverse=True)
ans=sum(l[:k])
print(ans)

Solution (Python):
n, k = map(int, input().split())
l_list = list(map(int, input().split()))
print(sum(sorted(l_list, reverse=True)[:k]))

Solution (Python):
def main():
    n, k = map(int, input().split())
    L = list(map(int, input().split()))

    print(sum(sorted(L)[::-1][:k]))

if __name__ == '__main__':
    main()

Solution (Python):
N, K = map(int, input().split())
l = sorted(list(map(int, input().split())), reverse=True)

L = 0
for i in range(K):
    L += l[i]
print(L)