output_description: Print the answer.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      X N
      p_1 ... p_N
attempt: num_input = [input() for i in range(2)]
  x = int(num_input[0].split()[0])
  n = int(num_input[0].split()[1])
  
  num_list = [int(n) for n in num_input[1].split()]
  num_list.sort()
  
  ans = x
  
  if n != 0 and n != 1 and n != 100:
      if x in num_list:
          index = num_list.index(x)
  
          value_left = x - 1
          value_right = x + 1
  
          if index != 0:
              index_left = index - 1
          if index != n - 1:
              index_right = index + 1
  
          if index == 0:
              ans = x - 1
          elif index == n - 1:
              if num_list[index - 1] != x - 1:
                  ans = x + 1
              else:
                  ans = x - 1
          else:
              for i in range(n):
                  if num_list[index_left] != value_left:
                      ans = value_left
                      break
                  elif num_list[index_right] != value_right:
                      ans = value_right
                      break
                  if index_left != 0:
                      index_left = index_left - 1
                  if index_right != n:
                      index_right = index_right + 1
                  value_left = value_left - 1
                  value_right = value_right + 1
  
  if n == 1:
      ans = x - 1
  
  if n == 100:
      if x <= 50:
          ans = 0
      if x > 50:
          ans = 101
  
  print(ans)
  
problem_description: Statement
  
  Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N.
  
  Among the integers not contained in the sequence p_1, \ldots, p_N (not
  necessarily positive), find the integer nearest to X, that is, find the
  integer whose absolute difference with X is the minimum. If there are multiple
  such integers, report the smallest such integer.
samples: [{"input": "6 5\n    4 7 10 6 5", "output": "8\n    \n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the one\nnearest to 6 is 8.\n\n* * *"}, {"input": "10 5\n    4 7 10 6 5", "output": "9\n    \n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the ones\nnearest to 10 are 9 and 11. We should print the smaller one, 9.\n\n* * *"}, {"input": "100 0", "output": "100\n    \n\nWhen N = 0, the second line in the input will be empty. Also, as seen here, X\nitself can be the answer."}]