def r gets.split.map &:to_i end M=1024 s=->a{c=[1]+[x=0]*M a.each{c[x^=_1]+=1} t=[0]*M (0...M).each{|i|(0...i).each{t[i^_1]+=c[i]*c[_1]} t[0]+=c[i]*~-c[i]/2} t} *n,k=r a=r b=r x=s[a] y=s[b] p (0...M).sum{x[_1]*y[_1^k]}.%10**9+7