'use strict'

const main = (INPUT) => {
  const [X, N] = INPUT.split('\n')[0].split(' ').map(n => Number(n))
  const p = INPUT.split('\n')[1].split(' ').map(n => Number(n))
  if (N == 0) {
    console.log(X)
    return
  }
  if (!p.includes(X)) {
    console.log(X)
  }
  let i = 1
  while (true) {
    if (!p.includes(X - i)) {
      console.log(X - i)
      return
    }
    if (!p.includes(X + i)) {
      console.log(X + i)
      return
    }
    i++
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))
