N,M = map(int,input().split()) if M % 2 == 1: print(0) exit() M2 = M // 2 N2 = N - 2 A = list(map(int,input().split())) S = set(A) ans = 0 cnt = 0 for a in A: if a + M2 in S: cnt += 1 print(cnt * N2)