TP05


Submit solution

Points: 10
Time limit: 1.0s
Memory limit: 512M

Problem type

Cho số nguyên dương \(n\) và dãy số nguyên \(a_1,a_2,…,a_n.\)

Yêu cầu: Tính tổng \(k\) số lớn nhất trong dãy.

Input

  • Dòng 1 chứa hai số \(n,k ( 1≤k≤n≤10^5).\)

  • Dòng thứ hai chứa \(a_1,a_2,…,a_n (a_i≤10^9 ).\)

Output

  • Tổng \(k\) số lớn nhất trong dãy tìm được.

Sample Input

8 3
7 2 6 5 3 6 4 1

Sample Output

19

Comments

There are no comments at the moment.