n, c = map(int,input().split())
nums = list(map(int,input().split()))
counts = {}
for num in nums:#统计输入数据中,各数据的个数,存储到字典中
counts[num] = counts.get(num,0)+1
result = 0
for key, value in counts.items():#遍历字典,查看字典中,是否有能和当前数据匹配的数据
target = key-c
if target in counts:
result += value*counts[target]
print(result)



京公网安备 11010502036488号