def binarysrch(lst, n, left, right): md = (left+right)/2 if lst[md] == n: return md if md == left: return -1 if lst[md] < n: return binarysrch(lst, n, md+1, right) return binarysrch(lst, n, left, md-1) N, X = map(int, raw_input().split()) a = map(int, raw_input().split()) a.sort() number = [] count = [] tmp = -1 for i in range(0, N): if a[i] == tmp: count[-1] += 1 else: number.append(a[i]) count.append(1) tmp = a[i] sum = 0 for i in range(0, len(number)): srch = binarysrch(number, X-a[i], 0, len(number)-1) if srch != -1: sum += count[i]*count[srch] print sum