438. K-th Missing Positive Number
EasyBinary Search
The array is strictly increasing and positive. Print the k-th positive integer missing from it.
Input format
Line 1: n k Line 2: n integers
Output format
The k-th missing number.
Example 1
Input
5 5 2 3 4 7 11
Output
9
Example 2
Input
4 2 1 2 3 4
Output
6
Constraints
1 ≤ n ≤ 1000 1 ≤ k ≤ 1000
Read input from standard input and print the answer to standard output. Your code is judged against 4 test cases, most of them hidden.
Loading the MyLoginn IDE…