#include #include #include using namespace std; using ll = long long; #include int op(int a,int b){ return a + b; } int e(){ return 0; } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n,k; cin>>n>>k; vector w(n),dx; for(int i = 0;i>w[i]; dx.push_back(abs(w[i])); } sort(dx.begin(),dx.end()); dx.erase(unique(dx.begin(),dx.end()),dx.end()); int m = dx.size(); atcoder::segtree seg(m); for(int i = 0;i0){ int use = seg.prod(ni,m);; if(use>=k) continue; seg.set(ni,seg.get(ni)+1); }else{ int use = seg.get(ni); use--; if(use<0) use = 0; seg.set(ni,use); } } cout<