#include using namespace std; int main(){ cin.tie(0),ios::sync_with_stdio(false); int n,k; cin>>n>>k; priority_queueq; for(int i=0;i>a; q.push(a); } int ans=q.top(); q.pop(); --k; while(q.size()&&k){ int a=q.top(); q.pop(); if(a<=0)break; ans+=a; --k; } cout<