def bs(array, aim): left = 0 right = len(array) - 1 while left <= right: pivot = (left + right) // 2 if array[pivot] == aim: return 1 elif array[pivot] > aim: right = pivot - 1 else: left = pivot + 1 return 0 N, X = map(int, input().split()) A = list(map(int, input().split())) A.sort() cnt = {} for a in A: if a in cnt: cnt[a] += 1 else: cnt[a] = 1 ans = 0 for a in range(N): x = X - A[a] if not x in cnt: cnt[x] = 0 ans += bs(A, x) * cnt[x] print(ans)