Option Explicit On
Imports System

Module Program
    Sub Main(args As String())

        Dim tmp As String() = Split(Console.ReadLine(), " ")

        Dim X As Integer = CInt(tmp(0))
        Dim N As Integer = CInt(tmp(1))

        If N = 0 Then
            Console.WriteLine(X)
            Exit Sub
        End If

        Dim tmp2 As String() = Split(Console.ReadLine(), " ")

        Dim P As New List(Of Integer)

        For i As Integer = 0 To N - 1
            P.Add(tmp2(i))
        Next

        Dim min As Integer = 1000
        Dim ans As Integer = 0

        For i As Integer = 0 To 101
            Dim wk As Integer = Math.Abs(i - X)
            If Not P.Contains(i) Then
                If min > wk Then
                    min = wk
                    ans = i
                End If
            End If
        Next

        Console.WriteLine(ans)

    End Sub
End Module
