#include using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x class BIT { public: V bit[1< bt; int N,K; int W[1000001]; void solve() { int i,j,k,l,r,x,y; string s; cin>>N>>K; FOR(i,N) { cin>>x; if(x>0) { if(bt.total(1<<20)-bt.total(x-1)