"use strict";

const main = (input) => {
    const spi = input.split('\n');
    const [x, n] = spi[0].split(' ').map(e => parseInt(e));
    const p = spi[1].split(' ').map(e => parseInt(e));

    let array = [];
    for (let i = -201; i <= 201; i++) {
        if (p.indexOf(i) === -1) array.push(i);
    }
    
    let minv = 210, ans = 0;
    for (let i = 0; i < array.length; i++) {
        const abx = Math.abs(x - array[i]);
        if (minv > abx) {
            minv = abx;
            ans = array[i];
        }
    }

    console.log(ans);
};

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