R=range J=lambda:map(int,input().split()) N,K=J() A=sorted(bin(n|1<<30)[3:]for n in J())+["1"*30] B=[[0]for d in R(30)] for d in R(30): for i in R(N+1):B[d]+=[B[d][-1]+(A[i][d]>'0')] M=N*(N-1)>>1 p=[[[0,N],[0,N]]] a=0 def D(v):return v[1]-v[0] for d in R(30): m,q=0,[[],[]] for v in p: s=[] for l,r in v: i,k=l-1,r while i+1>1 if B[d][l]0:q[e!=f]+=[[s[0][e],s[1][f]]] if M