"use strict";

function Main(input) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    input = input.split("\n");
    let tmp = input[0].split(" ");
    let x = parseInt(tmp[0], 10);
    let n = parseInt(tmp[1], 10);
    let p = input[1].split(" ").map(str => parseInt(str, 10)); //p[0], ... , p[n-1]

    p.sort(compareFunc);    //配列nを昇順に並べる

    let nearX = x;
    let i = 0;

    while (1) {
        nearX = x - i;
        if (!p.includes(nearX)) {
            console.log('%d', nearX);
            return;
        }
        nearX = x + i;
        if (!p.includes(nearX)) {
            console.log('%d', nearX);
            return;
        }
        i++;
    }

}

function compareFunc(a, b) {
    return a - b;
}


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