Triangles and a Circle

아직 제출이 없습니다시간 제한1초메모리 제한512 MB

문제

You are given nn distinct points on a circle of length LL.

You need to find the number of triangles with vertices in these points that contain the center of the circle inside, or on their border.

입력

The first line of input contains two integers nn and LL (3n300,0003 \leq n \leq 300\\,000, nL109n \leq L \leq 10^9).

Let's choose any point on the circle and call it SS. Then any point AA on the circle can be encoded as xx, 0x<L0 \le x < L: clockwise distance from SS to AA. We will call this number a coordinate of AA.

The second line contains nn distinct integers x_1,x_2,,x_nx\_1, x\_2, \ldots, x\_n: coordinates of the given points on the circle (0x_i<L0 \leq x\_i < L).

출력

Print one integer: the number of triangles with vertices in the given points, that contain the center of the circle inside or on their border.