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