N,X =map(int,input().split()) l =[0]*(10**5+1) for i in input().split(): s = int(i) l[s] += 1 ans = 0 if X < N: for i in range(X+1): ans += l[i]*l[X-i] elif X <= 2*N: for i in range(X-N,N+1): ans += l[i]*l[X-i] print(ans)