import sys,random input=sys.stdin.readline N,X=map(int,input().split()) A=list(map(int,input().split())) def solve_square(): data_conv = [[0 for j in range(256)] for i in range(1024)] data_bit = [[0 for j in range(8)] for i in range(1024)] cnt = [0 for i in range(1024)] mask = 255 for i in range(N): x,y = A[i]>>8, A[i]&mask data_conv[x][y] += 1 cnt[x] += 1 for j in range(8): if not y>>j & 1: data_bit[x][j] += 1 def all_sum(x,y): res = 0 upper_bit = (x | y) << 8 res += upper_bit * cnt[x] * cnt[y] for i in range(8): res += (1 << i) * (cnt[x] * cnt[y] - data_bit[x][i] * data_bit[y][i]) return res def convolute(x,y): res = 0 upper_bit = (x | y) << 8 for i in range(256): for j in range(256): if i^j < X&mask: res += (upper_bit + (i | j)) * data_conv[x][i] * data_conv[y][j] return res ans=0 for i in range(1024): for j in range(1024): if i^j < (X>>8): ans += all_sum(i,j) elif i^j == (X>>8): ans += convolute(i,j) ans -= sum(A) ans //= 2 return ans print(solve_square())