#include<stdio.h>
int main(void){
  char *s="python3 -c\""
"n,k,*a=map(int,open(0).read().split());t,s=2**40,0\n"
"while t:\n"
" c=sum((i&t)//t for i in a)\n"
" if k<t or c*2>=n:s+=t*c\n"
" else:s+=t*(n-c);k-=t\n"
" t//=2\n"
"print(s)\n"
"\"";
  system(s);
  return 0;
}            