_,k,*l=list(map(int,open(0).read().split()));print((sum(sorted(l)[-k:])))
t,l=open(0);print((sum(sorted(map(int,l.split()))[-int(t[2:]):])))
_, k, *l = list(map(int, open(0).read().split()))
print((sum(sorted(l)[-k:])))

t, l = open(0)
print((sum(sorted(map(int, l.split()))[-int(t[2:]) :])))

-_, k, *l = list(map(int, open(0).read().split())) -print((sum(sorted(l)[-k:]))) +t, l = open(0) +print((sum(sorted(map(int, l.split()))[-int(t[2:]) :])))