import math import copy n, x = [ int(v) for v in input().split(" ") ] number_list = [ int(v) for v in input().split(" ") ] sumlist = [] for i in range(n): sumlist.append([ number_list[i] + number_list[j] for j in range(n) ].count(x)) print(sum(sumlist))