const input = require('fs').readFileSync('/dev/stdin', 'utf-8').split('\n')
const [X, N] = input[0].split(' ').map(Number)

const solver = () => {
  if (N === 0) return X
  const p = input[1].split(' ').map(Number).map(v => v - X)
  if (!p.includes(0)) return X
  for (let i = 1; ; i++) {
    if (!p.includes(-i)) return X - i
    if (!p.includes(i)) return X + i
  }
}

console.log(solver())