import sys input = sys.stdin.readline N,M=map(int,input().split()) A=list(map(int,input().split())) A.sort() S=set(A) ANS=0 for a in A: if a+M//2 in S: ANS+=N-2 print(ANS)