87 #ABC170C. [ABC170C] Forbidden List

[ABC170C] Forbidden List

Score : 300300 points

Problem Statement

Given are an integer XX and an integer sequence of length NN: p1,,pNp_1, \ldots, p_N.

Among the integers not contained in the sequence p1,,pNp_1, \ldots, p_N (not necessarily positive), find the integer nearest to XX, that is, find the integer whose absolute difference with XX is the minimum. If there are multiple such integers, report the smallest such integer.

Constraints

  • 1X1001 \leq X \leq 100
  • 0N1000 \leq N \leq 100
  • 1pi1001 \leq p_i \leq 100
  • p1,,pNp_1, \ldots, p_N are all distinct.
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

XX NN

p1p_1 ...... pNp_N

Output

Print the answer.

6 5
4 7 10 6 5
8

Among the integers not contained in the sequence 4,7,10,6,54, 7, 10, 6, 5, the one nearest to 66 is 88.

10 5
4 7 10 6 5
9

Among the integers not contained in the sequence 4,7,10,6,54, 7, 10, 6, 5, the ones nearest to 1010 are 99 and 1111. We should print the smaller one, 99.

100 0
100

When N=0N = 0, the second line in the input will be empty. Also, as seen here, XX itself can be the answer.