#include<bits/stdc++.h> using namespace std; #include<atcoder/all> using namespace atcoder; using ll = long long; int n,k; vector<int> w; int op(int l,int r){ return l+r; } int e(){ return 0; } void solve(){ segtree<int,op,e> SEG(1000001); for(int i = 0;i<n;i++){ if(w[i]<0){ if(SEG.get(-w[i])<=0){ }else{ SEG.set(-w[i],SEG.get(-w[i])-1); } }else{ if(SEG.prod(w[i],1000001)>=k){ }else{ SEG.set(w[i],SEG.get(w[i])+1); } } } cout<<SEG.all_prod()<<endl; } signed main(){ cin.tie(nullptr); ios::sync_with_stdio(false); cin >> n >> k; w = vector<int>(n); for(auto &i:w)cin >> i; solve(); }