#include using namespace std; struct BinaryTrie{ struct Node{ int times = 0,lazy = 0; int L = -1,R = -1; }; private: int B; vector V; void eval(int pos,int i){ if(V.at(pos).lazy&(1<=0; i--){ V.at(pos).times++; if(V.at(pos).L == -1){ V.push_back({}),V.push_back({}); V.at(pos).L = V.size()-2,V.at(pos).R = V.size()-1; } eval(pos,i); if(x&(1<=0; i--){ if(pos == -1) break; eval(pos,i); if(x&(1<> N >> K; vector A(N); for(auto &a : A) cin >> a; int low = -1,high = (1<<30)-1; while(high-low > 1){ int mid = (high+low)/2; long long now = 0; BinaryTrie Z; for(int i=0; i