87 atcoder#ABC170C. [ABC170C] Forbidden List
[ABC170C] Forbidden List
Score : points
Problem Statement
Given are an integer and an integer sequence of length : .
Among the integers not contained in the sequence (not necessarily positive), find the integer nearest to , that is, find the integer whose absolute difference with is the minimum. If there are multiple such integers, report the smallest such integer.
Constraints
- are all distinct.
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
6 5
4 7 10 6 5
8
Among the integers not contained in the sequence , the one nearest to is .
10 5
4 7 10 6 5
9
Among the integers not contained in the sequence , the ones nearest to are and . We should print the smaller one, .
100 0
100
When , the second line in the input will be empty. Also, as seen here, itself can be the answer.