function main(input) {
  const inputs =input.split('\n')
  const [X, N] = inputs[0].split(' ').map(Number)
  const P = inputs[1].split(' ').map(Number)
  let min = 101
  let n = -1
  for (let i = 0; i <= 101; i++) {
    // console.log('i:', i)
    if (P.includes(i)) continue
    const d = Math.abs(X - i)
    // console.log('i:', i, 'd:', d)
    if (min <= d) break
    min = d
    n = i
  }
  console.log(n)
}

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