# your code goes here
n=int(input())
target=int(input())
arr=list(map(int, input().split()))
hashmap={}
ctr=0
for x in arr:
	req=target-x
	if req in hashmap:
		ctr+=hashmap[req]
	hashmap[x]=hashmap.get(x, 0)+1
print(ctr)
