local p={}
for i=1,100 do
    p[i]=i
end

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

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