#include using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int n,k; cin>>n>>k; vector a(n); rep(i,n){ int A; cin>>A; a[i]=A; } sort(a.begin(),a.end()); reverse(a.begin(),a.end()); int max_o=0; rep(i,k){ if(a[i]<0){ break; } max_o+=a[i]; } cout<