function main(input) {
  input = input.trim()
  const args = input.split("\n")

  args[0] = args[0].split(" ")
  const x = Number(args[0][0])
  const n = Number(args[0][1])

  if (n === 0) return console.log(x)

  const pArray = args[1].split(" ").map(v => Number(v))

  const candidates = []
  for (let i = x; i <= 101; i++) {
    if (!pArray.includes(i)) {
      candidates.push({ value: i, abs: Math.abs(x - i) })
      break
    }
  }
  for (let i = x; i >= 0; i--) {
    if (!pArray.includes(i)) {
      candidates.push({ value: i, abs: Math.abs(x - i) })
      break
    }
  }

  const result = candidates.reduce((acc, cur) => {
    return acc.abs < cur.abs ? acc.value : cur.value
  })

  console.log(result)
}

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