#include #define ll long long using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define rrep(i, n) for (int i = 1; i <= n; i++) ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; } ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); } using P = pair ; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b> n >>k; vectora; rep(i,n){ int b; cin >> b; if(b>0) a.push_back(b); } sort(a.begin(),a.end(),greater()); int ans = 0; if(k>=a.size()){ rep(i,a.size()) ans+=a[i]; cout << ans <