import bisect N,X=map(int,input().split()) a=list(map(int,input().split())) c=set(a) b=list(c) b.sort() #print(b) L=[0 for i in range(len(b))] for i in range(N): L[bisect.bisect_left(b,a[i])]+=1 #print(L) ans=0 ans2=0 for i in range(len(b)): if b[i]*2==X: ans2+=L[bisect.bisect_left(b,b[i])]**2 else: if (X-b[i]) in c: ans+=L[bisect.bisect_left(b,b[i])]*L[bisect.bisect_left(b,X-b[i])] #print(L[bisect.bisect_left(b,b[i])],L[bisect.bisect_left(b,X-b[i])]) print(ans+ans2) #print(ans,ans2)