N,X=map(int,input().split()) A=list(map(int,input().split())) def solve_square(): data_c=[[0 for j in range(512)] for i in range(512)] data_bit=[[0 for j in range(9)] for i in range(512)] cnt=[0 for i in range(512)] for i in range(N): x,y=A[i]>>9,A[i]%512 data_c[x][y]+=1 cnt[x]+=1 for j in range(9): if y>>j &1: data_bit[x][j]+=1 def all_sum(x,y): res=0 upper_const=(x^y)<<9 res+=upper_const*cnt[x]*cnt[y] for i in range(9): res+=(1<>9): ans+=all_sum(i,j) elif i^j==(X>>9): ans+=convolute(i,j) ans//=2 return ans print(solve_square())