from collections import Counter N, K = map(int, input().split()) A = list(map(int, input().split())) c = Counter(A) ans = 0 for k, v in c.items(): ans += v * c[K - k] print(ans)