import sys
from collections import Counter
N,C = map(int,input().split())
lst = list(map(int,input().split()))
#num_count为每个数出现的次数,key为num val为count
num_count=Counter(lst)
#计算满足条件的数对
result = 0
for num in num_count:
target = num+C
if target in num_count:
#对满足条件的数对排列组合
result+=num_count[num]*num_count[target]
print(result)

京公网安备 11010502036488号