#K12101. Find the Smallest Missing Integer Greater Than or Equal to K
Find the Smallest Missing Integer Greater Than or Equal to K
Find the Smallest Missing Integer Greater Than or Equal to K
Given an array of integers and an integer k, your task is to find the smallest positive integer M that is missing from the array and satisfies the condition $$M \geq k$$.
In other words, you need to determine the minimum positive integer that is not present in the array and is at least k.
For example, if the array is [3, 4, 2, 1, 7, 6] and k = 5, since 5 is not in the array and 5 ≥ 5, the answer is 5.
Please read the input from standard input (stdin) and output the result to standard output (stdout).
inputFormat
The input consists of two lines:
- The first line contains space-separated integers representing the array.
- The second line contains a single integer k.
outputFormat
Output a single integer, which is the smallest missing positive integer from the array that is greater than or equal to k.
## sample3 4 2 1 7 6
5
5