2020ICPC沈阳G
![在这里插入图片描述](https://img-blog.csdnimg.cn/9b86e815cbeb4b70b2988d0239ba676e.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQ1OTg1NzI4,size_16,color_FFFFFF,t_70#pic_center)
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define int long long
int n,k,m,sum;
priority_queue<int> q;
signed main(){
IOS;
cin>>n>>k;
while(n--)
cin>>m,q.push(m);
while(k--)
sum += q.top(),q.pop();
cout<<sum;
return 0;
}