N,K=map(int,input().split()) A=list(map(int,input().split())) r=N*(N-1)//2-K+1 # Trie木 Next_node_id0=[-1] Next_node_id1=[-1] Parent_id=[-1] # 親ノード Depth=[0] # Trieのノードの深さ Count=[0] # Trieのノードの重複度 LAST=[] Nodes_id=1 # 以下、標準入力で与えられたN個の文字列を追加する実装 for i in range(N): a=A[i] NOW=0 for i in range(30,-1,-1): if a & (1<OK+1: mid=(OK+NG)//2 count=0 for a in A: if count//2>=r: break now=0 count2=0 flag=0 for dep in range(30,-1,-1): x,y=Next_node_id0[now],Next_node_id1[now] #print(now,x,y,Count2[x],Count2[y],count2) if ((1<=",mid,"を満たすxをcount",count2) count+=count2 #print(count) if count//2>=r: OK=mid else: NG=mid print(OK)