#C5989. Find the Missing Integer
Find the Missing Integer
Find the Missing Integer
Given a starting integer \(x\) and an array of integers, your task is to find the smallest integer \(y\) such that \(y > x\) and \(y\) is not present in the array.
If the array does not contain any element greater than \(x\), output \(-1\).
Note: The input/output format must follow the standard input (stdin) and standard output (stdout) conventions.
inputFormat
The first line contains an integer \(x\). The second line contains an integer \(n\), representing the number of elements in the array. The third line contains \(n\) space-separated integers, which are the elements of the array.
outputFormat
Output a single integer: the smallest integer greater than \(x\) that is missing from the array. If there is no element in the array greater than \(x\), output \(-1\).
## sample3
6
1 3 6 4 1 2
5