from collections import defaultdict import sys def input(): return sys.stdin.readline().rstrip('\n') def main(): n, x = map(int, input().split()) *a, = map(int, input().split()) d = defaultdict(int) ans = 0 for i in a: ans += 2 * d[x-i] if 2*i == x: ans += 1 d[i] += 1 print(ans) if __name__ == '__main__': main()