AmazonOA #212
Get Maximum Count
估计中等可在线判题
Choose a contiguous range at most once and add the same arbitrary integer x to every number in it, maximizing the number of elements in the whole array equal to k. x may be negative or 0, and you may also skip the operation.
输入格式
The first line contains n k; the second line contains the array. 1≤n≤200000; 1≤element,k≤200000.
输出格式
Output a single integer, the answer.
样例 1
输入:
6 2
2 3 2 4 3 2
输出:
4
样例 2
输入:
6 6
6 4 4 6 4 4
输出:
5
样例 3
输入:
3 1
1 1 1
输出:
3
样例说明
The answers are 4, 5 and 3.