n, x = map(int, input().split()) a = list(map(int, input().split())) count = {} for i in a: if i in count: count[i] += 1 else: count[i] = 1 l = [] for key in count: if x-key in count and not key in l and not x-key in l: l.append(key) ans = 0 for i in l: ans += count[i]*count[x-i]*(2 if i != x-i else 1) print(ans)