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))
                  .sort((a, b) => a - b)

  let last = null
  for (let i = 1; i <= 101; i++) {
    if (pArray.includes(i) || i === x) continue

    const diff = Math.abs(x - i)
    if (!last) {
      last = { value: i, diff }
      continue
    }

    if (diff < last.diff) {
      last = { value: i, diff }
      continue
    }
    console.log(last.value)
    break
  }
}

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