import java.util.*;

class Main {
    private static Scanner sc;

    public static void main(final String[] args) {
        sc = new Scanner(System.in);
        int a = sc.nextInt(),b = sc.nextInt();
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < b; i++) list.add(sc.nextInt());
        if(!list.contains(a)){
            System.out.println(a);
            System.exit(0);           
        }     
        for (int i = 1; i <= 100; i++) {          
            a -= i;
            if(list.contains(a)){
                a += i*2;
                if(list.contains(a)){
                    a -= i;
                }else {
                    System.out.println(a);
                    System.exit(0);
                }
            }else {
                System.out.println(a);
                System.exit(0);
            }
           
        }
    }
}





 import java.util.*; util.* java class Main {
    private static Scanner sc;

    public static void main(final String[] args) {
        sc = new Scanner(System.in);
        int a = sc.nextInt(),b = sc.nextInt();
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < b; i++) list.add(sc.nextInt());
        if(!list.contains(a)){
            System.out.println(a);
            System.exit(0);           
        }     
        for (int i = 1; i <= 100; i++) {          
            a -= i;
            if(list.contains(a)){
                a += i*2;
                if(list.contains(a)){
                    a -= i;
                }else {
                    System.out.println(a);
                    System.exit(0);
                }
            }else {
                System.out.println(a);
                System.exit(0);
            }
           
        }
    }
} Main private static Scanner sc; sc public static void main(final String[] args) {
        sc = new Scanner(System.in);
        int a = sc.nextInt(),b = sc.nextInt();
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < b; i++) list.add(sc.nextInt());
        if(!list.contains(a)){
            System.out.println(a);
            System.exit(0);           
        }     
        for (int i = 1; i <= 100; i++) {          
            a -= i;
            if(list.contains(a)){
                a += i*2;
                if(list.contains(a)){
                    a -= i;
                }else {
                    System.out.println(a);
                    System.exit(0);
                }
            }else {
                System.out.println(a);
                System.exit(0);
            }
           
        }
    } main {
        sc = new Scanner(System.in);
        int a = sc.nextInt(),b = sc.nextInt();
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < b; i++) list.add(sc.nextInt());
        if(!list.contains(a)){
            System.out.println(a);
            System.exit(0);           
        }     
        for (int i = 1; i <= 100; i++) {          
            a -= i;
            if(list.contains(a)){
                a += i*2;
                if(list.contains(a)){
                    a -= i;
                }else {
                    System.out.println(a);
                    System.exit(0);
                }
            }else {
                System.out.println(a);
                System.exit(0);
            }
           
        }
    } sc = new Scanner(System.in) sc new Scanner(System.in) int a = sc.nextInt() a sc.nextInt() sc.nextInt sc b = sc.nextInt(); b sc.nextInt() sc.nextInt sc List<Integer> list = new ArrayList<>(); list new ArrayList<>() for (int i = 0; i < b; i++) list.add(sc.nextInt()); int i = 0; int i = 0; i 0 i < b i b i++ i++ i list.add(sc.nextInt()); list.add(sc.nextInt()) list.add list sc.nextInt() sc.nextInt sc if(!list.contains(a)){
            System.out.println(a);
            System.exit(0);           
        } !list.contains(a) list.contains(a) list.contains list a {
            System.out.println(a);
            System.exit(0);           
        } System.out.println(a) System.out.println System.out System System.out a System.exit(0) System.exit System 0 for (int i = 1; i <= 100; i++) {          
            a -= i;
            if(list.contains(a)){
                a += i*2;
                if(list.contains(a)){
                    a -= i;
                }else {
                    System.out.println(a);
                    System.exit(0);
                }
            }else {
                System.out.println(a);
                System.exit(0);
            }
           
        } int i = 1; int i = 1; i 1 i <= 100 i 100 i++ i++ i {          
            a -= i;
            if(list.contains(a)){
                a += i*2;
                if(list.contains(a)){
                    a -= i;
                }else {
                    System.out.println(a);
                    System.exit(0);
                }
            }else {
                System.out.println(a);
                System.exit(0);
            }
           
        } {          
            a -= i;
            if(list.contains(a)){
                a += i*2;
                if(list.contains(a)){
                    a -= i;
                }else {
                    System.out.println(a);
                    System.exit(0);
                }
            }else {
                System.out.println(a);
                System.exit(0);
            }
           
        } a -= i a i if(list.contains(a)){
                a += i*2;
                if(list.contains(a)){
                    a -= i;
                }else {
                    System.out.println(a);
                    System.exit(0);
                }
            }else {
                System.out.println(a);
                System.exit(0);
            } list.contains(a) list.contains list a {
                a += i*2;
                if(list.contains(a)){
                    a -= i;
                }else {
                    System.out.println(a);
                    System.exit(0);
                }
            } a += i*2 a i*2 i 2 if(list.contains(a)){
                    a -= i;
                }else {
                    System.out.println(a);
                    System.exit(0);
                } list.contains(a) list.contains list a {
                    a -= i;
                } a -= i a i {
                    System.out.println(a);
                    System.exit(0);
                } System.out.println(a) System.out.println System.out System System.out a System.exit(0) System.exit System 0 {
                System.out.println(a);
                System.exit(0);
            } System.out.println(a) System.out.println System.out System System.out a System.exit(0) System.exit System 0 final String[] args args
import java.util.*;

class Main {
    private static Scanner sc;

    public static void main(final String[] args) {
        sc = new Scanner(System.in);
        int a = sc.nextInt(),b = sc.nextInt();
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < b; i++) list.add(sc.nextInt());
        if(!list.contains(a)){
            System.out.println(a);
            System.exit(0);           
        }     
        for (int i = 1; i <= 100; i++) {          
            a -= i;
            if(list.contains(a)){
                a += i*2;
                if(list.contains(a)){
                    a -= i;
                }else {
                    System.out.println(a);
                    System.exit(0);
                }
            }else {
                System.out.println(a);
                System.exit(0);
            }
           
        }
    }
}






