from bisect import bisect_left, bisect_right def main(): N, M = map(int, input().split()) A = sorted(map(int, input().split())) if M % 2 == 1: print(0) return triangles = 0 for a_elm in A: if a_elm * 2 > M: break opposite = a_elm + M // 2 idx_1 = bisect_left(A, opposite) idx_2 = bisect_right(A, opposite) if idx_1 < idx_2: triangles += N - 2 print(triangles) if __name__ == "__main__": main()