#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; int main(){ int n, k; cin >> n >> k; vector a(n); for(int i = 0; i> a[i]; } sort(a.rbegin(), a.rend()); int sum = 0; for(int i = 0; i < k; i++){ if(a[i] > 0){ sum += a[i]; } } cout << sum << endl; return 0; }