local p={}
for i=0,101 do
    p[i]=i
end

local x,n=io.read("n","n")
for i=1,n do
    local input=io.read("n")
    p[input]=10000
end

local minabs=10000
for i=0,101 do
    if math.abs(minabs)>math.abs(p[i]-x) then
        minabs=p[i]-x
    end
end
print(minabs+x)