import java.util.*;

public class Main {
    public static void main(String[] args){

        Scanner scan = new Scanner( System.in );

        int x = Integer.parseInt( scan.next() );
        int n = Integer.parseInt( scan.next() );

        int[] p = new int[n];

        for(int i=0; i<n; i++){
            p[i] = Integer.parseInt( scan.next() );
        }

        Arrays.sort(p);

        Roop:
        for(int i=0; i<Integer.MAX_VALUE; i++){
            boolean flag = true;
            for(int j=0; j<n; j++){
                if(x-i == p[j]){
                    flag = false;
                    break;
                }
            }
            if(flag){
                System.out.println(x-i);
                break Roop;
            }
            for(int j=0; j<n; j++){
                if(x+i == p[j]){
                    continue Roop;
                }
            }
            System.out.println(x+i);
            break Roop;
        }
        

    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args){

        Scanner scan = new Scanner( System.in );

        int x = Integer.parseInt( scan.next() );
        int n = Integer.parseInt( scan.next() );

        int[] p = new int[n];

        for(int i=0; i<n; i++){
            p[i] = Integer.parseInt( scan.next() );
        }

        Arrays.sort(p);

        Roop:
        for(int i=0; i<Integer.MAX_VALUE; i++){
            boolean flag = true;
            for(int j=0; j<n; j++){
                if(x-i == p[j]){
                    flag = false;
                    break;
                }
            }
            if(flag){
                System.out.println(x-i);
                break Roop;
            }
            for(int j=0; j<n; j++){
                if(x+i == p[j]){
                    continue Roop;
                }
            }
            System.out.println(x+i);
            break Roop;
        }
        

    }
} Main public static void main(String[] args){

        Scanner scan = new Scanner( System.in );

        int x = Integer.parseInt( scan.next() );
        int n = Integer.parseInt( scan.next() );

        int[] p = new int[n];

        for(int i=0; i<n; i++){
            p[i] = Integer.parseInt( scan.next() );
        }

        Arrays.sort(p);

        Roop:
        for(int i=0; i<Integer.MAX_VALUE; i++){
            boolean flag = true;
            for(int j=0; j<n; j++){
                if(x-i == p[j]){
                    flag = false;
                    break;
                }
            }
            if(flag){
                System.out.println(x-i);
                break Roop;
            }
            for(int j=0; j<n; j++){
                if(x+i == p[j]){
                    continue Roop;
                }
            }
            System.out.println(x+i);
            break Roop;
        }
        

    } main {

        Scanner scan = new Scanner( System.in );

        int x = Integer.parseInt( scan.next() );
        int n = Integer.parseInt( scan.next() );

        int[] p = new int[n];

        for(int i=0; i<n; i++){
            p[i] = Integer.parseInt( scan.next() );
        }

        Arrays.sort(p);

        Roop:
        for(int i=0; i<Integer.MAX_VALUE; i++){
            boolean flag = true;
            for(int j=0; j<n; j++){
                if(x-i == p[j]){
                    flag = false;
                    break;
                }
            }
            if(flag){
                System.out.println(x-i);
                break Roop;
            }
            for(int j=0; j<n; j++){
                if(x+i == p[j]){
                    continue Roop;
                }
            }
            System.out.println(x+i);
            break Roop;
        }
        

    } Scanner scan = new Scanner( System.in ); scan new Scanner( System.in ) int x = Integer.parseInt( scan.next() ); x Integer.parseInt( scan.next() ) Integer.parseInt Integer scan.next() scan.next scan int n = Integer.parseInt( scan.next() ); n Integer.parseInt( scan.next() ) Integer.parseInt Integer scan.next() scan.next scan int[] p = new int[n]; p new int[n] n for(int i=0; i<n; i++){
            p[i] = Integer.parseInt( scan.next() );
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            p[i] = Integer.parseInt( scan.next() );
        } {
            p[i] = Integer.parseInt( scan.next() );
        } p[i] = Integer.parseInt( scan.next() ) p[i] p i Integer.parseInt( scan.next() ) Integer.parseInt Integer scan.next() scan.next scan Arrays.sort(p) Arrays.sort Arrays p String[] args args public class Main {
    public static void main(String[] args){

        Scanner scan = new Scanner( System.in );

        int x = Integer.parseInt( scan.next() );
        int n = Integer.parseInt( scan.next() );

        int[] p = new int[n];

        for(int i=0; i<n; i++){
            p[i] = Integer.parseInt( scan.next() );
        }

        Arrays.sort(p);

        Roop:
        for(int i=0; i<Integer.MAX_VALUE; i++){
            boolean flag = true;
            for(int j=0; j<n; j++){
                if(x-i == p[j]){
                    flag = false;
                    break;
                }
            }
            if(flag){
                System.out.println(x-i);
                break Roop;
            }
            for(int j=0; j<n; j++){
                if(x+i == p[j]){
                    continue Roop;
                }
            }
            System.out.println(x+i);
            break Roop;
        }
        

    }
} public class Main {
    public static void main(String[] args){

        Scanner scan = new Scanner( System.in );

        int x = Integer.parseInt( scan.next() );
        int n = Integer.parseInt( scan.next() );

        int[] p = new int[n];

        for(int i=0; i<n; i++){
            p[i] = Integer.parseInt( scan.next() );
        }

        Arrays.sort(p);

        Roop:
        for(int i=0; i<Integer.MAX_VALUE; i++){
            boolean flag = true;
            for(int j=0; j<n; j++){
                if(x-i == p[j]){
                    flag = false;
                    break;
                }
            }
            if(flag){
                System.out.println(x-i);
                break Roop;
            }
            for(int j=0; j<n; j++){
                if(x+i == p[j]){
                    continue Roop;
                }
            }
            System.out.println(x+i);
            break Roop;
        }
        

    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args){

        Scanner scan = new Scanner( System.in );

        int x = Integer.parseInt( scan.next() );
        int n = Integer.parseInt( scan.next() );

        int[] p = new int[n];

        for(int i=0; i<n; i++){
            p[i] = Integer.parseInt( scan.next() );
        }

        Arrays.sort(p);

        Roop:
        for(int i=0; i<Integer.MAX_VALUE; i++){
            boolean flag = true;
            for(int j=0; j<n; j++){
                if(x-i == p[j]){
                    flag = false;
                    break;
                }
            }
            if(flag){
                System.out.println(x-i);
                break Roop;
            }
            for(int j=0; j<n; j++){
                if(x+i == p[j]){
                    continue Roop;
                }
            }
            System.out.println(x+i);
            break Roop;
        }
        

    }
}