local mab = math.abs
local x, n = io.read("*n", "*n")
local t = {}
for i = -101, 101 do
  t[i] = true
end
for i = 1, n do
  local a = io.read("*n")
  t[a] = false
end
local cand = -101
for i = -100, 101 do
  if t[i] then
    if mab(x - i) < mab(x - cand) then
      cand = i
    end
  end
end
print(cand)
