import sys input=lambda: sys.stdin.readline().rstrip() n,x=map(int,input().split()) A=[int(i) for i in input().split()] import collections D=collections.defaultdict(int) ans=0 for a in A: ans+=2*D[x-a] D[a]+=1 if a*2==x: ans+=1 print(ans)