/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
    public static void main (String[] args) throws java.lang.Exception
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());

        int X = Integer.parseInt(st.nextToken());
        int N = Integer.parseInt(st.nextToken());
        st = new StringTokenizer(br.readLine());
        HashSet<Integer> hs = new HashSet<>();
        for (int i=0; i<N; i++)
            hs.add(Integer.parseInt(st.nextToken()));
        int ans=500,a=0;
        for (int i=0; i<200; i++){
            if (hs.contains(i))
                continue;
            if (Math.abs(i-X)<ans){
                ans=Math.abs(i-X);
                a=i;
            }
        }
        System.out.println(a);
    }




}
 import java.util.*; util.* java import java.lang.*; lang.* java import java.io.*; io.* java class Main
{
    public static void main (String[] args) throws java.lang.Exception
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());

        int X = Integer.parseInt(st.nextToken());
        int N = Integer.parseInt(st.nextToken());
        st = new StringTokenizer(br.readLine());
        HashSet<Integer> hs = new HashSet<>();
        for (int i=0; i<N; i++)
            hs.add(Integer.parseInt(st.nextToken()));
        int ans=500,a=0;
        for (int i=0; i<200; i++){
            if (hs.contains(i))
                continue;
            if (Math.abs(i-X)<ans){
                ans=Math.abs(i-X);
                a=i;
            }
        }
        System.out.println(a);
    }




} Main public static void main (String[] args) throws java.lang.Exception
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());

        int X = Integer.parseInt(st.nextToken());
        int N = Integer.parseInt(st.nextToken());
        st = new StringTokenizer(br.readLine());
        HashSet<Integer> hs = new HashSet<>();
        for (int i=0; i<N; i++)
            hs.add(Integer.parseInt(st.nextToken()));
        int ans=500,a=0;
        for (int i=0; i<200; i++){
            if (hs.contains(i))
                continue;
            if (Math.abs(i-X)<ans){
                ans=Math.abs(i-X);
                a=i;
            }
        }
        System.out.println(a);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());

        int X = Integer.parseInt(st.nextToken());
        int N = Integer.parseInt(st.nextToken());
        st = new StringTokenizer(br.readLine());
        HashSet<Integer> hs = new HashSet<>();
        for (int i=0; i<N; i++)
            hs.add(Integer.parseInt(st.nextToken()));
        int ans=500,a=0;
        for (int i=0; i<200; i++){
            if (hs.contains(i))
                continue;
            if (Math.abs(i-X)<ans){
                ans=Math.abs(i-X);
                a=i;
            }
        }
        System.out.println(a);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) StringTokenizer st = new StringTokenizer(br.readLine()); st new StringTokenizer(br.readLine()) int X = Integer.parseInt(st.nextToken()); X Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st int N = Integer.parseInt(st.nextToken()); N Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) HashSet<Integer> hs = new HashSet<>(); hs new HashSet<>() for (int i=0; i<N; i++)
            hs.add(Integer.parseInt(st.nextToken())); int i=0; int i=0; i 0 i<N i N i++ i++ i hs.add(Integer.parseInt(st.nextToken())); hs.add(Integer.parseInt(st.nextToken())) hs.add hs Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st int ans=500 ans 500 a=0; a 0 for (int i=0; i<200; i++){
            if (hs.contains(i))
                continue;
            if (Math.abs(i-X)<ans){
                ans=Math.abs(i-X);
                a=i;
            }
        } int i=0; int i=0; i 0 i<200 i 200 i++ i++ i {
            if (hs.contains(i))
                continue;
            if (Math.abs(i-X)<ans){
                ans=Math.abs(i-X);
                a=i;
            }
        } {
            if (hs.contains(i))
                continue;
            if (Math.abs(i-X)<ans){
                ans=Math.abs(i-X);
                a=i;
            }
        } if (hs.contains(i))
                continue; hs.contains(i) hs.contains hs i continue; if (Math.abs(i-X)<ans){
                ans=Math.abs(i-X);
                a=i;
            } Math.abs(i-X)<ans Math.abs(i-X) Math.abs Math i-X i X ans {
                ans=Math.abs(i-X);
                a=i;
            } ans=Math.abs(i-X) ans Math.abs(i-X) Math.abs Math i-X i X a=i a i System.out.println(a) System.out.println System.out System System.out a String[] args args
/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
    public static void main (String[] args) throws java.lang.Exception
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());

        int X = Integer.parseInt(st.nextToken());
        int N = Integer.parseInt(st.nextToken());
        st = new StringTokenizer(br.readLine());
        HashSet<Integer> hs = new HashSet<>();
        for (int i=0; i<N; i++)
            hs.add(Integer.parseInt(st.nextToken()));
        int ans=500,a=0;
        for (int i=0; i<200; i++){
            if (hs.contains(i))
                continue;
            if (Math.abs(i-X)<ans){
                ans=Math.abs(i-X);
                a=i;
            }
        }
        System.out.println(a);
    }




}

