#P6949. Swap

    ID: 5806 远端评测题 2000ms 256MiB 尝试: 0 已通过: 0 难度: (无) 上传者: 标签>2021“MINIEYE杯”中国大学生算法设计超级联赛-热身赛(2021湘潭全国邀请赛-重现)

Swap

Problem Description

You are given a sequence of length $N$, and there is also a number $H$ in your hands.

In each step, you can swap the number in your hands with one of the numbers in the sequence.

Now you need to find the minimum steps to make the sequence in non-decreasing order.

Input

There are multiple test cases.

For each test case, the first line contains two integers $N$ and $H$, denoting the length of the sequence and the number in your hands initially.

The second line contains $N$ integers $A_1,A_2,\ldots,A_N$, denoting the initial sequence.

$1\leq H,A_i \leq 10^9$. And the sum of $N$ of all test cases is not larger than $300000$.

Output

For each test case, print an integer in one line, denoting your answer.

4 3 1 4 2 5 4 3 1 2 5 4 6 2 2 3 4 2 3 4 6 2 3 4 5 3 4 5
2 1 3 4