import sys readline=sys.stdin.readline N,M=map(int,readline().split()) A=set(map(int,readline().split())) ans=0 for a in A: if M%2==0 and a<=M//2 and a+M//2 in A: ans+=N-2 print(ans)