import java.util.Scanner;
import java.util.TreeSet;

public class Main {
    public static void main(String args[]) {
        Scanner sc=new Scanner(System.in);
        int X=sc.nextInt();
        int N=sc.nextInt();
        int pos[]=new int[102];
        for(int i=0;i<N;++i) {
            int no=sc.nextInt();
            pos[no]++;
        }
        int i;
        for(i=X;i>=0;--i) {
            if(pos[i]==0)
                break;
        }
        int j;
        for(j=X+1;j<102;++j) {
            if(pos[j]==0)
                break;
        }
        if(j-X<X-i) {
            System.out.println(j);
        } else {
            System.out.println(i);
        }

    }
} import java.util.Scanner; Scanner java.util import java.util.TreeSet; TreeSet java.util public class Main {
    public static void main(String args[]) {
        Scanner sc=new Scanner(System.in);
        int X=sc.nextInt();
        int N=sc.nextInt();
        int pos[]=new int[102];
        for(int i=0;i<N;++i) {
            int no=sc.nextInt();
            pos[no]++;
        }
        int i;
        for(i=X;i>=0;--i) {
            if(pos[i]==0)
                break;
        }
        int j;
        for(j=X+1;j<102;++j) {
            if(pos[j]==0)
                break;
        }
        if(j-X<X-i) {
            System.out.println(j);
        } else {
            System.out.println(i);
        }

    }
} Main public static void main(String args[]) {
        Scanner sc=new Scanner(System.in);
        int X=sc.nextInt();
        int N=sc.nextInt();
        int pos[]=new int[102];
        for(int i=0;i<N;++i) {
            int no=sc.nextInt();
            pos[no]++;
        }
        int i;
        for(i=X;i>=0;--i) {
            if(pos[i]==0)
                break;
        }
        int j;
        for(j=X+1;j<102;++j) {
            if(pos[j]==0)
                break;
        }
        if(j-X<X-i) {
            System.out.println(j);
        } else {
            System.out.println(i);
        }

    } main {
        Scanner sc=new Scanner(System.in);
        int X=sc.nextInt();
        int N=sc.nextInt();
        int pos[]=new int[102];
        for(int i=0;i<N;++i) {
            int no=sc.nextInt();
            pos[no]++;
        }
        int i;
        for(i=X;i>=0;--i) {
            if(pos[i]==0)
                break;
        }
        int j;
        for(j=X+1;j<102;++j) {
            if(pos[j]==0)
                break;
        }
        if(j-X<X-i) {
            System.out.println(j);
        } else {
            System.out.println(i);
        }

    } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int X=sc.nextInt(); X sc.nextInt() sc.nextInt sc int N=sc.nextInt(); N sc.nextInt() sc.nextInt sc int pos[]=new int[102]; pos new int[102] 102 for(int i=0;i<N;++i) {
            int no=sc.nextInt();
            pos[no]++;
        } int i=0; int i=0; i 0 i<N i N ++i ++i i {
            int no=sc.nextInt();
            pos[no]++;
        } {
            int no=sc.nextInt();
            pos[no]++;
        } int no=sc.nextInt(); no sc.nextInt() sc.nextInt sc pos[no]++ pos[no] pos no int i; i for(i=X;i>=0;--i) {
            if(pos[i]==0)
                break;
        } i=X; i=X i X i>=0 i 0 --i --i i {
            if(pos[i]==0)
                break;
        } {
            if(pos[i]==0)
                break;
        } if(pos[i]==0)
                break; pos[i]==0 pos[i] pos i 0 break; int j; j for(j=X+1;j<102;++j) {
            if(pos[j]==0)
                break;
        } j=X+1; j=X+1 j X+1 X 1 j<102 j 102 ++j ++j j {
            if(pos[j]==0)
                break;
        } {
            if(pos[j]==0)
                break;
        } if(pos[j]==0)
                break; pos[j]==0 pos[j] pos j 0 break; if(j-X<X-i) {
            System.out.println(j);
        } else {
            System.out.println(i);
        } j-X<X-i j-X j X X-i X i {
            System.out.println(j);
        } System.out.println(j) System.out.println System.out System System.out j {
            System.out.println(i);
        } System.out.println(i) System.out.println System.out System System.out i String args[] args public class Main {
    public static void main(String args[]) {
        Scanner sc=new Scanner(System.in);
        int X=sc.nextInt();
        int N=sc.nextInt();
        int pos[]=new int[102];
        for(int i=0;i<N;++i) {
            int no=sc.nextInt();
            pos[no]++;
        }
        int i;
        for(i=X;i>=0;--i) {
            if(pos[i]==0)
                break;
        }
        int j;
        for(j=X+1;j<102;++j) {
            if(pos[j]==0)
                break;
        }
        if(j-X<X-i) {
            System.out.println(j);
        } else {
            System.out.println(i);
        }

    }
} public class Main {
    public static void main(String args[]) {
        Scanner sc=new Scanner(System.in);
        int X=sc.nextInt();
        int N=sc.nextInt();
        int pos[]=new int[102];
        for(int i=0;i<N;++i) {
            int no=sc.nextInt();
            pos[no]++;
        }
        int i;
        for(i=X;i>=0;--i) {
            if(pos[i]==0)
                break;
        }
        int j;
        for(j=X+1;j<102;++j) {
            if(pos[j]==0)
                break;
        }
        if(j-X<X-i) {
            System.out.println(j);
        } else {
            System.out.println(i);
        }

    }
} Main
import java.util.Scanner;
import java.util.TreeSet;

public class Main {
    public static void main(String args[]) {
        Scanner sc=new Scanner(System.in);
        int X=sc.nextInt();
        int N=sc.nextInt();
        int pos[]=new int[102];
        for(int i=0;i<N;++i) {
            int no=sc.nextInt();
            pos[no]++;
        }
        int i;
        for(i=X;i>=0;--i) {
            if(pos[i]==0)
                break;
        }
        int j;
        for(j=X+1;j<102;++j) {
            if(pos[j]==0)
                break;
        }
        if(j-X<X-i) {
            System.out.println(j);
        } else {
            System.out.println(i);
        }

    }
}