#include using namespace std; using ll = long long; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); ll n,k; cin>>n>>k; vector a(n); for(int i = 0;i>a[i]; ll ans = 1e18; priority_queue que; priority_queue q1; vector use(n,1e18); ll sum = 0; if(k==1){ cout<=0;i--){ use[i] = a[i]; if(i+1need){ sum -= que.top(); que.pop(); } if(que.size()+1==need){ if(que.empty()){ ans = min(ans,a[i]); }else{ ll mx = need * k; mx--; if(mx