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