cswork / OA打开练习工作台

IBMOA #25

Find Missing Integer

估计中等可在线判题

考点(AI 标注)二分查找原地数组

Find the k-th smallest positive integer that does not appear in the array; duplicates do not take up extra positions.

输入格式

The first line contains n k, and the second line contains the array. 1≤n≤200000, 1≤element≤10^9, 1≤k≤10^12.

输出格式

Output one integer, the answer.

样例 1

输入:

5 5
1 4 7 3 4

输出:

9

样例 2

输入:

2 1
1 1

输出:

2

样例 3

输入:

1 2
9

输出:

2

样例说明

The examples give 9, 2 and 2 respectively.