local read = io.read
local insert = table.insert
local abs = math.abs

local X, N = read("*n", "*n")
local p = {}
for i = 1, N do
	p[i] = read("*n")
end

local not_p = {}
for i = 0, 101 do
	local can_ins = true
	for j = 1, N do
		if p[j] == i then
			can_ins = false
			break
		end
	end
	if can_ins then
		insert(not_p, i)
	end
end

local out = math.huge
for i = 1, #not_p do
	if abs(not_p[i] - X) < abs(out - X) then
		out = not_p[i]
	end
end

print(out)
