def xorconv(n,X,Y,mod=0): if mod: if n==0: res=[(X[0]*Y[0])%mod] return res bit = 1<<(n-1) x=[X[i]+X[i^bit] for i in range(2**(n-1))] y=[Y[i]+Y[i^bit] for i in range(2**(n-1))] z=[X[i]-X[i^bit] for i in range(2**(n-1))] w=[Y[i]-Y[i^bit] for i in range(2**(n-1))] res1=xorconv(n-1,x,y) res2=xorconv(n-1,z,w) former=[(res1[i]+res2[i])*inv for i in range(2**(n-1))] latter=[(res1[i]-res2[i])*inv for i in range(2**(n-1))] former=list(map(lambda x:x%mod,former)) latter=list(map(lambda x:x%mod,latter)) return former+latter else: if n==0: res=[(X[0]*Y[0])] return res bit = 1<<(n-1) x=[X[i]+X[i^bit] for i in range(bit)] y=[Y[i]+Y[i^bit] for i in range(bit)] z=[X[i]-X[i^bit] for i in range(bit)] w=[Y[i]-Y[i^bit] for i in range(bit)] res1=xorconv(n-1,x,y) res2=xorconv(n-1,z,w) former=[(res1[i]+res2[i])//2 for i in range(bit)] latter=[(res1[i]-res2[i])//2 for i in range(bit)] return former+latter N,X = map(int,input().split()) A = list(map(int,input().split())) cnt = [0 for i in range(2**18)] for a in A: cnt[a] += 1 cnt = xorconv(18,cnt,cnt) cnt = sum(cnt[:X]) res = 0 for i in range(18): data = [0 for j in range(2**18)] for j in range(N): if not A[j]>>i & 1: data[A[j]] += 1 data = xorconv(18,data,data) plus = 1<