100 atcoder#ABC067B. [ABC067B] Snake Toy

[ABC067B] Snake Toy

Score : 200200 points

Problem Statement

Snuke has NN sticks. The length of the ii-th stick is lil_i.

Snuke is making a snake toy by joining KK 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

  • 1KN501 \leq K \leq N \leq 50
  • 1li501 \leq l_i \leq 50
  • lil_i is an integer.

Input

Input is given from Standard Input in the following format:

NN KK

l1l_1 l2l_2 l3l_3 ...... lNl_{N}

Output

Print the answer.

5 3
1 2 3 4 5
12

You can make a toy of length 1212 by joining the sticks of lengths 33, 44 and 55, which is the maximum possible length.

15 14
50 26 27 21 41 7 42 35 7 5 5 36 39 1 45
386