const Main = input => {
    input = input.split("\n");
    const xn = input[0].split(" ").map(value => parseInt(value, 10));

    const x = xn[0];
    const n = xn[1];

    let near;
    if(n === 0) {
        //nが0のときはx自身を答えにする
        near = x;
    } else {
        const p = input[1].split(" ").map(value => parseInt(value, 10));

        //pに存在する整数を除いた1~100までのリスト
        const list = [];
        for(let i = 0; i <= 101; i++) {
            if(p.includes(i)) continue;
            list.push(i);
        }

        const diff = [];
        let index = 0;
        //リストの中からxとの差の絶対値が最も小さい数を見つける
        list.forEach((i, val) => {
            diff[i] = Math.abs(x - val);
            index = (diff[index] < diff[i]) ? index : i;
        })
        near = diff[index];
    }

    console.log(near);
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));