시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB311100.000%

문제

Grammy has a circular array $a_1, a_2, \ldots, a_n$. You can do the following operations several (possibly zero) times in any order:

  • Choose two adjacent positions with the same number, and erase them.
  • Choose two adjacent positions such that the numbers on these positions add up to a special number $x$, and erase them.

After each time you do an operation successfully, Grammy will give you a candy. Meanwhile, the remaining parts of the array will be concatenated. For example, after deleting the third and fourth element of the array, the second element and the fifth element will become adjacent.

Find the maximum number of candies you can get.

Two positions $u$ and $v$ ($u<v$) are adjacent if and only if $u+1=v$ or $u=1$ and $v=L$, where $L$ is the length of the remaining array.

입력

The first line contains two integers $n$ and $x$ ($1 \leq n \leq 10^5$, $1 \leq x \leq 10^9$) denoting the length of the array and the special number $x$.

The second line contains $n$ integers $a_1, a_2,\ldots, a_n$ ($1 \leq a_i \leq 10^9$) denoting the numbers in the circular array.

출력

Output an integer denoting the maximum number of candies you can get.

예제 입력 1

6 5
1 1 4 5 1 4

예제 출력 1

2

예제 입력 2

10 5
1 2 5 2 1 2 3 4 8 4

예제 출력 2

3