CodeEff/ECCO huggingface dataset:
# Original solution
#python3
from math import floor
def main():
    a, b = list(map(int, input().split()))
    for i in range(1, 1200):
        x1 = floor(i*0.08)
        x2 = floor(i*0.1)
        if x1 == a and x2 == b:
            print(i)
            return
    print('-1')
main()


# Optimized solution
#python3
from math import ceil
def main():
    a, b = list(map(int, input().split()))
    a1 = 12.5*a
    a2 = 12.5*(a+1)
    b1 = 10*b
    b2 = 10*(b+1)
    if a2 <= b1:
        print('-1')
        return 
    if b2 <= a1:
        print('-1')
        return
    ans = max(ceil(a1), b1)
    print(ans)
main()
# Original solution
def resolve():
    a, b = list(map(int, input().split()))
    j=-1
    for i in range(1263):
        c = i*0.08//1
        d = i*0.1//1
        if c==a and d==b:
            j=i
            break
    print(j)
resolve()

# Optimized solution
def resolve():
    a, b = list(map(int, input().split()))
    for i in range(1300):
        if int(i*0.08) == a and int(i*0.1) == b:
            print(i)
            exit()
    print((-1))
resolve()
# Original solution
from math import floor
a, b = list(map(int, input().split()))

for i in range(1, 1000000):
  if floor(i * 0.08) == a and floor(i * 0.1) == b:
    print(i)
    exit()
print((-1))

# Optimized solution
# C - Tax Increase
# https://atcoder.jp/contests/abc158/tasks/abc158_c

a, b = list(map(int, input().split()))

for x in range(1, 100000):
  if int(x * 0.08) == a and int(x * 0.1) == b:
    print(x)
    exit()

print((-1))
# Original solution
# C - Tax Increase
# https://atcoder.jp/contests/abc158/tasks/abc158_c

a, b = list(map(int, input().split()))

for x in range(1, 100000):
  if int(x * 0.08) == a and int(x * 0.1) == b:
    print(x)
    exit()

print((-1))

# Optimized solution
a, b = list(map(int, input().split()))

for i in range(10001):
  if int(i * 0.08) == a and int(i * 0.1) == b:
    print(i)
    exit()
    
print((-1))
# Original solution
A, B = list(map(int, input().split()))
ans = -1
for x in range(10001):
    if int(x*0.08) == A and int(x*0.1) == B:
        ans = x
        break

print(ans)


# Optimized solution
A, B = list(map(int, input().split()))
ans = -1
for x in range(1010):
    if int(x*0.08) == A and int(x*0.1) == B:
        ans = x
        break

print(ans)
# Original solution
import sys
# import math
# import decimal
# import queue
# import bisect
# import heapq
# import time
# import itertools
# from fractions import Fraction

mod = int(1e9+7)
INF = 1<<29

def main():
    a,b = list(map(int,input().split()))
    ans = []
    x = int(min(a//0.08,b//0.1))
    y = int(max((a+1)//0.08,b//0.1))
    for i in range(x,y+1):
        if int(i*0.08)==a and int(i*0.1)==b:
            ans.append(i)
    if len(ans):
        print((min(ans)))
    else:
        print((-1))
    return

if __name__=='__main__':
    main()


# Optimized solution
import sys
# import math
# import decimal
# import queue
# import bisect
# import heapq
# import time
# import itertools
# from fractions import Fraction

mod = int(1e9+7)
INF = 1<<29

def main():
    a,b = list(map(int,input().split()))
    ans = []
    x = int(min(a//0.08,b//0.1))
    y = int(max((a+1)//0.08,(b+1)//0.1))
    for i in range(x,y+1):
        if int(i*0.08)==a and int(i*0.1)==b:
            ans.append(i)
    if len(ans):
        print((min(ans)))
    else:
        print((-1))
    return

if __name__=='__main__':
    main()
# Original solution
import sys
# import math
# import decimal
# import queue
# import bisect
# import heapq
# import time
# import itertools
# from fractions import Fraction

mod = int(1e9+7)
INF = 1<<29

def main():
    a,b = list(map(int,input().split()))
    ans = []
    x = int(min(a//0.08,b//0.1))
    y = int(max((a+1)//0.08,(b+1)//0.1))
    for i in range(x,y+1):
        if int(i*0.08)==a and int(i*0.1)==b:
            ans.append(i)
    if len(ans):
        print((min(ans)))
    else:
        print((-1))
    return

if __name__=='__main__':
    main()


# Optimized solution
import sys

a,b = list(map(int,input().split()))
low = int(min(a//0.08,b//0.1))
high = int(max((a+1)//0.08,(b+1)//0.1))
for i in range(low,high+1):
  if int(i*0.08)==a and int(i*0.1)==b:
    print(i)
    sys.exit()
print((-1))
# Original solution
import math

A, B = list(map(int,input().split()))

cnt = 0
for i in range(1,100000):
    X = math.floor(i * 0.08)
    Y = math.floor(i * 0.1)
    if A == X and B == Y:
        print(i)
        cnt += 1
        break
        
if cnt == 0:
    print((-1))

# Optimized solution
A,B = list(map(int,input().split()))

import math
ans = -1
for i in range(10000):
    if math.floor(i*0.08) == A and math.floor(i*0.1) == B:
        ans=i
        break
print(ans)
# Original solution
import math

def main():
    A, B = list(map(int, input().split()))

    # 条件を満たす可能性のある最小の正数を計算
    x_min = max(math.ceil(A / 0.08), math.ceil(B / 0.1))
    # 条件を満たす可能性のある最大の正数を計算
    x_max = min((math.ceil((A + 1) / 0.08), math.ceil((B + 1) / 0.1)))

    # 候補の正数を順番にチェックし、満たすものがあればそれを出力して終了
    for x in range(x_min, x_max + 1):
        if (math.floor(x * 0.08) == A) and (math.floor(x * 0.1) == B):
            print(x)
            quit()

    # ここまで来るときは満たすものがないので、-1を出力
    print((-1))


if __name__ == "__main__":
    main()

# Optimized solution
from math import floor

# 入力値の取得
A, B = list(map(int, input().split()))

# 問題の制約から、答えの候補としてあり得る範囲をチェック
# for _ in range(1010)で０〜１００９までのループが使える
for price in range(1010):
    if (floor(price * 0.08) == A) and (floor(price * 0.1) == B):
        # 条件を満たしたのでその金額を表示して終了
        # （小さい金額から順番にみていくので、最初に条件を満たしたものが、
        # 　条件を満たす金額のうちで最小の金額になる。）
        print(price)
        quit()

# 条件を満たすものが見つかっていれば、プログラムが終了するので、
# ここまで実行される時は、条件を満たす金額が存在しないということなので、
# 条件を満たす金額が存在しない時に表示すべき -1 を表示する。
# 最小行なので、quit()しなくてもプログラムが終了する
print((-1))
# Original solution
import math
a, b= list(map(int, input().split()))
for n in range(1, 20000):
  if math.floor(n*0.08) == a and math.floor(n*0.1) == b:
    break
    
if n != 19999:
  print(n)
else:
  print((-1))

# Optimized solution
import math
a, b= list(map(int, input().split()))
for n in range(1, 1010):
  aa, bb = math.floor(n*0.08), math.floor(n*0.1)
  if aa == a and bb == b:
    print(n)
    exit()   
print((-1))
# Original solution
import math

a,b = [int(x) for x in input().split()]


hati_s = a/0.08
hati_l = (a+1)/0.08

ten_s = b/0.1
ten_l = (b+1)/0.1

#print(hati_s,hati_l,ten_s,ten_l)


def intersec(a_min,a_max,b_min,b_max):
    if a_min < b_min:
        if a_max < b_min:
            return [0,0]
        else:
            if a_max < b_max:
                return [b_min,b_max]
            else:
                return [b_min,a_max]
    else:
        if b_max < a_min:
            return [0,0]
        else:
            if b_max < a_max:
                return [a_min,a_max]
            else:
                return [a_min,a_max]


def min_int(pair):
    if pair == [0,0]:
        return -1
    else:
        return math.ceil(pair[0])



tmp = intersec(hati_s,hati_l,ten_s,ten_l)

if math.ceil(tmp[0]) == math.ceil(tmp[1]):
    print((-1))
else:
    tst = min_int(tmp)
    if math.floor(tst*0.08) == a and math.floor(tst*0.1) == b:
        print(tst)
    else:
        print((-1))



# Optimized solution
import math

a,b = [int(x) for x in input().split()]


hati_s = a/0.08
hati_l = (a+1)/0.08

ten_s = b/0.1
ten_l = (b+1)/0.1

#print(hati_s,hati_l,ten_s,ten_l)


def intersec(a_min,a_max,b_min,b_max):
    if a_min < b_min:
        if a_max < b_min:
            return [0,0]
        else:
            if a_max < b_max:
                return [b_min,a_max]
            else:
                return [b_min,b_max]
    else:
        if b_max < a_min:
            return [0,0]
        else:
            if b_max < a_max:
                return [a_min,b_max]
            else:
                return [a_min,a_max]


def min_int(pair):
    if pair == [0,0]:
        return -1
    else:
        return math.ceil(pair[0])



tmp = intersec(hati_s,hati_l,ten_s,ten_l)

if math.ceil(tmp[0]) == math.ceil(tmp[1]):
    print((-1))
else:
    tst = min_int(tmp)
    print(tst)
# Original solution
#!/usr/bin/env python3
a, b = list(map(int, input().split()))
for i in range(10 ** 5):
    if i * 8 // 100 == a and i // 10 == b:
        print(i)
        exit()
print((-1))


# Optimized solution
#!/usr/bin/env python3
a, b = list(map(int, input().split()))
mn = max(100 * a, 80 * b)
mx = min(100 * a + 99, 80 * b + 72)
print(((mn + 7) // 8 if mn <= mx else -1))
# Original solution
A,B=input().split()
A=int(A)
B=int(B)
price1_min=A/0.08
price1_max=(A+1)/0.08
price2_min=B/0.1
price2_max=(B+1)/0.1

if price2_min>=price1_max or price1_min>=price2_max:
    print((-1))

else:
    price=max(price1_min,price2_min)
    if price==int(price):
        print((int(price)))
    else:
        print((int(price)+1))
    
    

# Optimized solution
def tax(a, b):
    for i in range(1,1010):
        if int(i*0.08) == a and int(i*0.1) == b:
            print(i)
            return
    print((-1))
    return

a, b = list(map(int, input().strip().split()))
tax(a,b)
# Original solution
import math

A, B = list(map(int, input().split()))

ans = -1

for i in range(1, 1000000):
    if math.floor(i * 0.08) == A and math.floor(i * 0.1) == B:
        ans = i
        break
print(ans)

# Optimized solution
import math

A, B = list(map(int, input().split()))

ans = -1

for i in range(1, 100000):
    if math.floor(i * 0.08) == A and math.floor(i * 0.1) == B:
        ans = i
        break
print(ans)
# Original solution
A, B = list(map(int, input().split()))
for i in range(1, 10001):
    if int(i*0.08) == A and int(i*0.1) == B:
        print(i)
        break
else:
    print((-1))

# Optimized solution
import sys
A,B = list(map(int,input().split()))
for i in range(1,1251):
  C_8 = int(i*0.08)
  C_10 = int(i*0.1)
  if C_8 == A and C_10 == B:
    print(i)
    sys.exit()

print((-1))
# Original solution
import math
A, B = list(map(int, input().split()))
minV = math.ceil(A / 0.08)
maxV = int((A + 1) / 0.08)
for i in range(minV, maxV):
    if int(i * 0.1) == B:
        print(i)
        exit()
print((-1))

# Optimized solution
import math
A, B = list(map(int, input().split()))
max = 1001 # これ以上の値は絶対に条件Bを満たさない。
for i in range(1, max):
    if int(i * 0.08) == A and int(i * 0.1) == B:
        print(i)
        exit()
print((-1))
# Original solution
A, B = list(map(int, input().split()))

ans = -1
for i in range(1, 20001):
    a = int(i * 1.08) - i
    b = int(i * 1.1) - i
    if A == a and B == b:
        ans = i
        break
print(ans)


# Optimized solution
A, B= list(map(int, input().split()))

for i in range(1,1010):
    if int(i*0.08)==A and int(i*0.1)==B:
        print(i)
        break
else:
    print('-1')
# Original solution
def main():
    a, b = list(map(int, input().split()))
    eight = [i for i in range(0, 2000) if a == int(i * 0.08)]
    ten = [i for i in range(0, 2000) if b == int(i * 0.1)]
    for i in eight:
        for j in ten:
            if i == j:
                print(i)
                return
    print((-1))


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    a, b = list(map(int, input().split()))
    al = int(a / 0.08 + 0.5)
    bl = int(b / 0.1)
    au = al + 12 - a % 2
    bu = bl + 9
    if bu < al or au < bl:
        print((-1))
    else:
        print((max(al, bl)))


if __name__ == '__main__':
    main()
# Original solution
import math
from decimal import *
A,B = list(map(int, input().split()))
ans = -1
for x in range(1, 50000):
    a = math.floor(x * Decimal(0.08))
    b = math.floor(x * Decimal(0.1))
    if a == A and b == B:
        ans = x
        break
print(ans)

# Optimized solution
import math
from decimal import *
A,B = list(map(int, input().split()))
ans = -1
for x in range(1, 10001):
    a = math.floor(x * Decimal(0.08))
    b = math.floor(x * Decimal(0.1))
    if a == A and b == B:
        ans = x
        break
print(ans)
# Original solution
def c_tax_increase():
    A, B = [int(i) for i in input().split()]
    for k in range(1, 10**6):
        t1 = 8 * k // 100
        t2 = k // 10
        if t1 > 0 and t2 > 0 and t1 == A and t2 == B:
            return k
    return -1

print((c_tax_increase()))

# Optimized solution
def c_tax_increase():
    from math import floor, ceil
    A, B = [int(i) for i in input().split()]
    lower = ceil(max(25 * A / 2, 10 * B))
    upper = floor(min(25 * (A + 1) / 2, 10 * (B + 1)))
    return lower if lower < upper else -1

print((c_tax_increase()))
# Original solution
# ABC158 C
a,b=list(map(int,input().split()))
# x=a*(100/8)
# y=b*(100/10)

# print(x,y)
# print(int(x),int(y))

# sx=x*((108-8)/100)
# sy=y*((110-10)/100)

# print(int(sx),int(sy))

for i in range(200000):
    x,y=0.0,0.0
    x=i*0.08
    y=i*0.10
    if a==int(x) and b==int(y):
        print(i)
        exit()
print((-1))

# Optimized solution
a,b=list(map(int,input().split()))
for i in range(1,10001):
  tax_a=int(i*0.08)
  tax_b=int(i*0.10)
  if tax_a==a and tax_b==b:
    print(i)
    exit(0)
print((-1))
# Original solution
import math
a, b = list(map(int, input().split()))

for i in range(1000000):
    if math.floor(i*0.08) == a and math.floor(i*0.1) == b:
        print(i)
        exit(0)

print((-1))

# Optimized solution
import math

a, b = list(map(int, input().split()))

for i in range(1001):
    if math.floor(i * 0.08) == a and math.floor(i * 0.1) == b:
        print(i)
        exit(0)

print((-1))
# Original solution
A, B = list(map(int,input().split()))
for i in range(10 ** 6 + 1):
    if i * 8 // 100 == A and i // 10 == B:
        print(i)
        exit()
print("-1")

# Optimized solution
A, B = list(map(int, input().split()))
for ans in range(1, 1001):
    tmp_A = ans * 8 // 100
    tmp_B = ans // 10
    if tmp_A == A and tmp_B == B:
        print(ans)
        exit()
print('-1')
# Original solution
a, b = list(map(int, input().split()))

pa = 0 - -a//0.08
pb = b/0.1

ref = max(pa, pb)
refmin = min(pa, pb)

ta = int(ref*0.08)
tb = int(ref*0.1)

flag = 0

for i in range(2000):
    if i == 1999:
        print((-1))
    elif ta != a or tb != b and flag == 0:
        ref -= 1
        ta = int(ref*0.08)
        tb = int(ref*0.1)
        if ta == a and tb == b:
            flag += 1

    elif ta == a and tb == b:
        flag += 1
        ref -= 1
        ta = int(ref*0.08)
        tb = int(ref*0.1)
        if ta != a or tb != b:
            print((int(ref + 1)))
            break
    else:
        print((-1))
        break

# Optimized solution
a, b = list(map(int, input().split()))

for i in range(1100):
    if i//12.5 == a and i//10 == b:
        print(i)
        exit()

print((-1))
# Original solution
A, B = list(map(int, input().split()))


ans = -1
for x in range(100000):
    a = int(x * 0.08)
    b = int(x * 0.1)
    if a == A and b == B:
        ans = x
        break

print(ans)


# Optimized solution
A, B = list(map(int, input().split()))
for x in range(10000):
    a = int(x * 0.08)
    b = int(x * 0.1)
    if a == A and b == B:
        print(x)
        exit()
print((-1))
# Original solution
n,k=list(map(int,input().split()))
l=list(map(int,input().split()))
l.sort(reverse=True)
x=0
for i in range(k):
    x=x+l[i]

print(x)

    


# Optimized solution
n,k=list(map(int,input().split()))
l=list(map(int,input().split()))
l=sorted(l,reverse=True)

print((sum(l[0:k])))
# Original solution
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
a=sorted(a)

b=sum(a)
for i in range(n-k):
    b-=a[i]

print(b)

# Optimized solution
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
a=sorted(a,reverse=True)

print((sum(a[:k])))
# Original solution

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

k = sorted(l)

ans = 0

for i in range(K):
    ans += k.pop()

print(ans)


# Optimized solution

n,k = list(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)
# Original solution
N,K = list(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)

# Optimized solution
N, K = list(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)
# Original solution
n,k=input().split()
print((sum(sorted(list(map(int,input().split())))[:-int(k)-1:-1])))

# Optimized solution
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A = sorted(A, reverse = True)

ans = 0
for i in range(K):
    ans += A[i]

print(ans)
# Original solution
N,K=list(map(int,input().split()))
l=list(map(int,input().split()))
from itertools import combinations

ans=0
for c in combinations(list(range(N)),K):
  ans=max(ans,sum([l[i] for i in c]))
print(ans)

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

print((sum(l[:K])))
# Original solution
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort(reverse=True)
print((sum(A[0:k])))


# Optimized solution
n, k = list(map(int, input().split()))
L = list(map(int, input().split()))
L.sort(reverse=True)
print((sum(L[0:k])))
# Original solution
# _*_ coding:utf-8 _*_
#  Atcoder_Beginners_Contest067-B
#  TODO https://atcoder.jp/contests/abc067/tasks/abc067_b
import time
from contextlib import contextmanager
# from time import sleep
@contextmanager
def timer(title):
	t0 = time.time()
	yield
	print(("{} - done in {:.0f}s".format(title,time.time()-t0) ))

def  calcLongSnakeToy(needBarNumber,barLengthList):
	longSortedToyList = sorted(barLengthList,reverse=True)
	getBarCountRange = list(range(0,needBarNumber,+1))
	longLength = 0
	for i in getBarCountRange:
		longLength = longLength + longSortedToyList[i]
	answer = longLength
	return answer


if __name__ == '__main__':
	_,K = list(map(int,input().strip().split(' ')))
	lengthList = list(map(int,input().strip().split(' ')))
	solution=calcLongSnakeToy(K,lengthList)
	print(("{}".format(solution)))

# Optimized solution
# Problem: https://atcoder.jp/contests/abc067/tasks/abc067_b
# Python 1st Try

import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque


def II(): return int(sys.stdin.readline())


def MI(): return list(map(int, sys.stdin.readline().split()))


def LI(): return list(map(int, sys.stdin.readline().split()))


def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solver(selectNum, barLongth):
    result = 0
    barLongth.sort(reverse=True)
    #   print("{}".format(barLongth))
    # algorithm
    j = 0
    while j < selectNum:
        result = result + barLongth[j]
        j = j + 1
    return result


if __name__ == "__main__":
    _, K = MI()  # Nは要らない
    LII = LI()
    print(("{}".format(solver(K, LII))))
# Original solution
# Problem:
# Python 2nd Try

import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque


def II(): return int(sys.stdin.readline())


def MI(): return list(map(int, sys.stdin.readline().split()))


def LI(): return list(map(int, sys.stdin.readline().split()))


def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solver(selectNum, snakeLongList):
    result = 0
    sortedSnakeLongList = sorted(snakeLongList, reverse=True)
    for j in range(0, selectNum, +1):
        result = result + sortedSnakeLongList[j]
    # algorithm
    return result


if __name__ == "__main__":
    _, K = MI()
    LongI = LI()
    print(("{}".format(solver(K, LongI))))


# Optimized solution
# Problem: https://atcoder.jp/contests/abc067/tasks/abc067_b
# Python 3rd Try

import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque


def II(): return int(sys.stdin.readline())


def MI(): return list(map(int, sys.stdin.readline().split()))


def LI(): return list(map(int, sys.stdin.readline().split()))


def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solver(allNumber, selectNum, eachLength):
    result = 0
    # algorithm
    sortedStickLength = sorted(eachLength, reverse=True)
    #    print("{}:{}".format(sortedStickLength, eachLength))
    for j in range(0, selectNum, +1):
        result = result + sortedStickLength[j]
    return result


if __name__ == "__main__":
    N, K = MI()
    StickList = LI()
    print(("{}".format(solver(N, K, StickList))))
# Original solution
N, K = list(map(int, input().split()))
l = [int(x) for x in input().split()]

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

# Optimized solution
N, K = list(map(int, input().split()))
l = list(map(int, input().split()))
l.sort()
print((sum(l[-K:])))
# Original solution
N, K = list(map(int, input().split()))
l = list(map(int, input().split()))

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

# Optimized solution
N, K =list(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)
# Original solution
n, k = list(map(int, input().split()))
l = list(map(int, input().split()))
l.sort(reverse = True)

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

# Optimized solution
n,k = list(map(int, input().split()))
ll = list(map(int, input().split()))
ll.sort()
print((sum(ll[len(ll)-k:])))
# Original solution
N, K = list(map(int, input().split()))
L = list(map(int, input().split()))
L.sort(reverse=True)

print((sum(L[:K])))


# Optimized solution
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort(reverse=True)
print((sum(A[:K])))
# Original solution
n,k = list(map(int, input().split()))
l = [int(i) for i in input().split()]
l.sort(reverse = True)
ans =0
for j in range(k):
  ans += l[j]
print(ans)

# Optimized solution
n,k = list(map(int,input().split()))
l = [int(_) for _ in input().split()]
l.sort(reverse=True)
print((sum(l[:k])))
# Original solution
# ABC 067 B - Snake Toy

n_k = list(map(int,input().split()))
li = list(map(int,input().split()))
n=n_k[0]
k=n_k[1]

toy = 0
li.sort(reverse=True)

for i in range(k):
    toy += li[0]
    li.pop(0)
print(toy)


# Optimized solution
# 067 B
N,K= list(map(int,input().split()))
L=[int(j) for j in input().split()]
L.sort(reverse=True)
print((sum(L[0:K])))
# Original solution
n,k = list(map(int,input().split()))
l = sorted(list(map(int,input().split())),reverse = True)
print((sum(l[:k])))

# Optimized solution
n,k = list(map(int,input().split()))
print((sum(sorted(map(int,input().split()))[::-1][:k])))
# Original solution
n,k=list(map(int,input().split()))
l=sorted([int(_) for _ in input().split()])[::-1]
print((sum(l[i] for i in range(0,k))))

# Optimized solution
n,k=list(map(int,input().split()))
l=sorted([int(_) for _ in input().split()])
print((sum(l[-k:])))
# Original solution
from itertools import groupby, accumulate, product, permutations, combinations
def solve():
  N, K = list(map(int, input().split()))
  L = list(map(int, input().split()))
  ans = 0
  for com in combinations(L,K):
    cnt = 0
    for c in com:
      cnt += c
    ans = max(ans,cnt)
  return ans
print((solve()))

# Optimized solution
from itertools import groupby, accumulate, product, permutations, combinations
def solve():
  N, K = list(map(int, input().split()))
  L = list(map(int, input().split()))
  L.sort(reverse=True)
  ans = sum(L[:K])
  return ans
print((solve()))
# Original solution
_,k,*l=list(map(int,open(0).read().split()));print((sum(sorted(l)[-k:])))

# Optimized solution
t,l=open(0);print((sum(sorted(map(int,l.split()))[-int(t[2:]):])))
# Original solution
N,K =list(map(int,input().split()))
l = sorted(list(map(int,input().split())))

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

# Optimized solution
N,K =list(map(int,input().split()))
l = sorted(list(map(int,input().split())))

print((sum(l[N-K:])))
# Original solution
n, k = list(map(int, input().split()))
print(( sum(sorted([ int(x) for x in input().split()], reverse = True)[:k]) ))

# Optimized solution
_, K = list(map(int, input().split()))
L = list(map(int, input().split()))

print((sum(sorted(L, reverse=True)[:K])))
# Original solution
n,k = list(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)

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