ceo= input().split()
n=int(ceo[0])
q=int(ceo[1])
ceo=input().split()
a=[]
for i in range(len(ceo)):
    a.append(int(ceo[i]))



def dalije(a , upalindromu,t):
    if a in upalindromu:
        upalindromu=upalindromu.replace(a,'')
        if len(upalindromu)==0 : t=True
        return True
    else:
        return False

palindrom=''
for i in range(1,len(a)):
    palindrom=palindrom+str(a[i-1]^a[i])
clan=a[len(a)-1]^a[0]
palindrom= palindrom + ''+str(clan)

duzina=len(ceo)
potrebna=duzina/2
res=''+str(a[0])
for i in range(1,n):
    res=''+str(a[i])
    t=False
    f=dalije(res,palindrom,t)
    while f :
        f=dalije(res,palindrom,t)
        print(f)
    if t : kraj=i
    print(i)