#include #define rep(i,a,b) for(int i=int(a);i<=int(b);++i) using namespace std; templatevoid pr(A a){cout << (a) << endl;} templatevoid pr(A a,B b){cout << a << " " ;pr(b);} templatevoid pr(A a,B b,C c){cout << a << " " ;pr(b,c);} templatevoid pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);} typedef long long ll; typedef pair l_l; typedef pair i_i; int INF=numeric_limits::max(); // for(int j=0;j>n>>k; ll ans=0; int a[n+10]; int A; rep(i,0,n-1) { cin>>A; a[i]=A; } sort(a,a+n,greater()); rep(i,0,k) { ans+=a[i]; } pr(ans); return 0; }