Candies
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Grammy has a circular array . You can do the following operations several (possibly, zero) times:

1. Choose two adjacent positions with the same number, and erase them.

2. 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 part 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,v() are adjacent if and only if or , where L is the length of the remaining array.

输入描述:

The first line contains two integers n,x (), denoting the length of the array and the special number x.

The secons line contains n integers (), 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

输出

复制
2
示例2

输入

复制
10 5
1 2 5 2 1 2 3 4 8 4

输出

复制
3