import java.util.Scanner;


public class Main{
    public static Scanner scan  = new Scanner(System.in);
    public static void main(String[]args){
        int x = nextInt();
        int n = nextInt();

        if(n==0){
            print(x);
            System.exit(0);
        }

        boolean flag;
        flag = true;
        int[] arr = new int[n];

        int min,min_i,tmp;
        min = 1000;
        min_i = 1000;
        for(int i=0;i<n;i++){
            arr[i] = nextInt();
        }
        for(int a:arr){
            if(x==a){
                flag = false;
            }
        }
        if(flag){
            print(x);
            System.exit(0);
        }

        for(int i=1;i<101;i++){
            flag = true;
            tmp = x-i;
            for(int a:arr){
                if(a!=tmp){
                    flag=true;
                    min = tmp;
                }
                else{
                    flag = false;
                    break;
                }
            }
            if(flag){
                print(min);
                System.exit(0);
            }

            flag = true;
            tmp = x+i;
            for(int a:arr){
                if(a!=tmp){
                    flag=true;
                    min = tmp;
                }
                else{
                    flag = false;
                    break;
                }
            }
            if(flag){
                print(min);
                System.exit(0);
            }

        }
    }

    public static int nextInt(){
        return Integer.parseInt(scan.next());
    }
    public static long nextLong(){
        return Long.parseLong(scan.next());
    }
    public static String next(){
        return scan.next();
    }
    public static double nextDouble(){
        return Double.parseDouble(scan.next());
    }
    public static float nextFloat(){
        return Float.parseFloat(scan.next());
    }

    //Yes or No
    public static void yesNo(boolean flag){
        if(flag) System.out.println("Yes");
        else System.out.println("No");
    }

    //print
    public static void print(Object a){
        System.out.println(a);
    }


    //gcd
    public static int gcd (int a, int b){
        int tmp;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return b;
    }


    //lcm
    public static int lcm(int a,int b){
        int tmp;
        long c = a;
        c *= b;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return (int)(c/b);
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static Scanner scan  = new Scanner(System.in);
    public static void main(String[]args){
        int x = nextInt();
        int n = nextInt();

        if(n==0){
            print(x);
            System.exit(0);
        }

        boolean flag;
        flag = true;
        int[] arr = new int[n];

        int min,min_i,tmp;
        min = 1000;
        min_i = 1000;
        for(int i=0;i<n;i++){
            arr[i] = nextInt();
        }
        for(int a:arr){
            if(x==a){
                flag = false;
            }
        }
        if(flag){
            print(x);
            System.exit(0);
        }

        for(int i=1;i<101;i++){
            flag = true;
            tmp = x-i;
            for(int a:arr){
                if(a!=tmp){
                    flag=true;
                    min = tmp;
                }
                else{
                    flag = false;
                    break;
                }
            }
            if(flag){
                print(min);
                System.exit(0);
            }

            flag = true;
            tmp = x+i;
            for(int a:arr){
                if(a!=tmp){
                    flag=true;
                    min = tmp;
                }
                else{
                    flag = false;
                    break;
                }
            }
            if(flag){
                print(min);
                System.exit(0);
            }

        }
    }

    public static int nextInt(){
        return Integer.parseInt(scan.next());
    }
    public static long nextLong(){
        return Long.parseLong(scan.next());
    }
    public static String next(){
        return scan.next();
    }
    public static double nextDouble(){
        return Double.parseDouble(scan.next());
    }
    public static float nextFloat(){
        return Float.parseFloat(scan.next());
    }

    //Yes or No
    public static void yesNo(boolean flag){
        if(flag) System.out.println("Yes");
        else System.out.println("No");
    }

    //print
    public static void print(Object a){
        System.out.println(a);
    }


    //gcd
    public static int gcd (int a, int b){
        int tmp;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return b;
    }


    //lcm
    public static int lcm(int a,int b){
        int tmp;
        long c = a;
        c *= b;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return (int)(c/b);
    }
} Main public static Scanner scan  = new Scanner(System.in); scan new Scanner(System.in) public static void main(String[]args){
        int x = nextInt();
        int n = nextInt();

        if(n==0){
            print(x);
            System.exit(0);
        }

        boolean flag;
        flag = true;
        int[] arr = new int[n];

        int min,min_i,tmp;
        min = 1000;
        min_i = 1000;
        for(int i=0;i<n;i++){
            arr[i] = nextInt();
        }
        for(int a:arr){
            if(x==a){
                flag = false;
            }
        }
        if(flag){
            print(x);
            System.exit(0);
        }

        for(int i=1;i<101;i++){
            flag = true;
            tmp = x-i;
            for(int a:arr){
                if(a!=tmp){
                    flag=true;
                    min = tmp;
                }
                else{
                    flag = false;
                    break;
                }
            }
            if(flag){
                print(min);
                System.exit(0);
            }

            flag = true;
            tmp = x+i;
            for(int a:arr){
                if(a!=tmp){
                    flag=true;
                    min = tmp;
                }
                else{
                    flag = false;
                    break;
                }
            }
            if(flag){
                print(min);
                System.exit(0);
            }

        }
    } main {
        int x = nextInt();
        int n = nextInt();

        if(n==0){
            print(x);
            System.exit(0);
        }

        boolean flag;
        flag = true;
        int[] arr = new int[n];

        int min,min_i,tmp;
        min = 1000;
        min_i = 1000;
        for(int i=0;i<n;i++){
            arr[i] = nextInt();
        }
        for(int a:arr){
            if(x==a){
                flag = false;
            }
        }
        if(flag){
            print(x);
            System.exit(0);
        }

        for(int i=1;i<101;i++){
            flag = true;
            tmp = x-i;
            for(int a:arr){
                if(a!=tmp){
                    flag=true;
                    min = tmp;
                }
                else{
                    flag = false;
                    break;
                }
            }
            if(flag){
                print(min);
                System.exit(0);
            }

            flag = true;
            tmp = x+i;
            for(int a:arr){
                if(a!=tmp){
                    flag=true;
                    min = tmp;
                }
                else{
                    flag = false;
                    break;
                }
            }
            if(flag){
                print(min);
                System.exit(0);
            }

        }
    } int x = nextInt(); x nextInt() nextInt int n = nextInt(); n nextInt() nextInt if(n==0){
            print(x);
            System.exit(0);
        } n==0 n 0 {
            print(x);
            System.exit(0);
        } print(x) print x System.exit(0) System.exit System 0 boolean flag; flag flag = true flag true int[] arr = new int[n]; arr new int[n] n int min min min_i min_i tmp; tmp min = 1000 min 1000 min_i = 1000 min_i 1000 for(int i=0;i<n;i++){
            arr[i] = nextInt();
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            arr[i] = nextInt();
        } {
            arr[i] = nextInt();
        } arr[i] = nextInt() arr[i] arr i nextInt() nextInt for(int a:arr){
            if(x==a){
                flag = false;
            }
        } int a arr {
            if(x==a){
                flag = false;
            }
        } {
            if(x==a){
                flag = false;
            }
        } if(x==a){
                flag = false;
            } x==a x a {
                flag = false;
            } flag = false flag false if(flag){
            print(x);
            System.exit(0);
        } flag {
            print(x);
            System.exit(0);
        } print(x) print x System.exit(0) System.exit System 0 for(int i=1;i<101;i++){
            flag = true;
            tmp = x-i;
            for(int a:arr){
                if(a!=tmp){
                    flag=true;
                    min = tmp;
                }
                else{
                    flag = false;
                    break;
                }
            }
            if(flag){
                print(min);
                System.exit(0);
            }

            flag = true;
            tmp = x+i;
            for(int a:arr){
                if(a!=tmp){
                    flag=true;
                    min = tmp;
                }
                else{
                    flag = false;
                    break;
                }
            }
            if(flag){
                print(min);
                System.exit(0);
            }

        } int i=1; int i=1; i 1 i<101 i 101 i++ i++ i {
            flag = true;
            tmp = x-i;
            for(int a:arr){
                if(a!=tmp){
                    flag=true;
                    min = tmp;
                }
                else{
                    flag = false;
                    break;
                }
            }
            if(flag){
                print(min);
                System.exit(0);
            }

            flag = true;
            tmp = x+i;
            for(int a:arr){
                if(a!=tmp){
                    flag=true;
                    min = tmp;
                }
                else{
                    flag = false;
                    break;
                }
            }
            if(flag){
                print(min);
                System.exit(0);
            }

        } {
            flag = true;
            tmp = x-i;
            for(int a:arr){
                if(a!=tmp){
                    flag=true;
                    min = tmp;
                }
                else{
                    flag = false;
                    break;
                }
            }
            if(flag){
                print(min);
                System.exit(0);
            }

            flag = true;
            tmp = x+i;
            for(int a:arr){
                if(a!=tmp){
                    flag=true;
                    min = tmp;
                }
                else{
                    flag = false;
                    break;
                }
            }
            if(flag){
                print(min);
                System.exit(0);
            }

        } flag = true flag true tmp = x-i tmp x-i x i for(int a:arr){
                if(a!=tmp){
                    flag=true;
                    min = tmp;
                }
                else{
                    flag = false;
                    break;
                }
            } int a arr {
                if(a!=tmp){
                    flag=true;
                    min = tmp;
                }
                else{
                    flag = false;
                    break;
                }
            } {
                if(a!=tmp){
                    flag=true;
                    min = tmp;
                }
                else{
                    flag = false;
                    break;
                }
            } if(a!=tmp){
                    flag=true;
                    min = tmp;
                }
                else{
                    flag = false;
                    break;
                } a!=tmp a tmp {
                    flag=true;
                    min = tmp;
                } flag=true flag true min = tmp min tmp {
                    flag = false;
                    break;
                } flag = false flag false break; if(flag){
                print(min);
                System.exit(0);
            } flag {
                print(min);
                System.exit(0);
            } print(min) print min System.exit(0) System.exit System 0 flag = true flag true tmp = x+i tmp x+i x i for(int a:arr){
                if(a!=tmp){
                    flag=true;
                    min = tmp;
                }
                else{
                    flag = false;
                    break;
                }
            } int a arr {
                if(a!=tmp){
                    flag=true;
                    min = tmp;
                }
                else{
                    flag = false;
                    break;
                }
            } {
                if(a!=tmp){
                    flag=true;
                    min = tmp;
                }
                else{
                    flag = false;
                    break;
                }
            } if(a!=tmp){
                    flag=true;
                    min = tmp;
                }
                else{
                    flag = false;
                    break;
                } a!=tmp a tmp {
                    flag=true;
                    min = tmp;
                } flag=true flag true min = tmp min tmp {
                    flag = false;
                    break;
                } flag = false flag false break; if(flag){
                print(min);
                System.exit(0);
            } flag {
                print(min);
                System.exit(0);
            } print(min) print min System.exit(0) System.exit System 0 String[]args args public static int nextInt(){
        return Integer.parseInt(scan.next());
    } nextInt {
        return Integer.parseInt(scan.next());
    } return Integer.parseInt(scan.next()); Integer.parseInt(scan.next()) Integer.parseInt Integer scan.next() scan.next scan public static long nextLong(){
        return Long.parseLong(scan.next());
    } nextLong {
        return Long.parseLong(scan.next());
    } return Long.parseLong(scan.next()); Long.parseLong(scan.next()) Long.parseLong Long scan.next() scan.next scan public static String next(){
        return scan.next();
    } next {
        return scan.next();
    } return scan.next(); scan.next() scan.next scan public static double nextDouble(){
        return Double.parseDouble(scan.next());
    } nextDouble {
        return Double.parseDouble(scan.next());
    } return Double.parseDouble(scan.next()); Double.parseDouble(scan.next()) Double.parseDouble Double scan.next() scan.next scan public static float nextFloat(){
        return Float.parseFloat(scan.next());
    } nextFloat {
        return Float.parseFloat(scan.next());
    } return Float.parseFloat(scan.next()); Float.parseFloat(scan.next()) Float.parseFloat Float scan.next() scan.next scan //Yes or No
    public static void yesNo(boolean flag){
        if(flag) System.out.println("Yes");
        else System.out.println("No");
    } yesNo {
        if(flag) System.out.println("Yes");
        else System.out.println("No");
    } if(flag) System.out.println("Yes");
        else System.out.println("No"); flag System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" boolean flag flag //print
    public static void print(Object a){
        System.out.println(a);
    } print {
        System.out.println(a);
    } System.out.println(a) System.out.println System.out System System.out a Object a a //gcd
    public static int gcd (int a, int b){
        int tmp;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return b;
    } gcd {
        int tmp;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return b;
    } int tmp; tmp while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        } (tmp = a%b) != 0 (tmp = a%b) tmp a%b a b 0 {
            a = b;
            b = tmp;
        } a = b a b b = tmp b tmp return b; b int a a int b b //lcm
    public static int lcm(int a,int b){
        int tmp;
        long c = a;
        c *= b;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return (int)(c/b);
    } lcm {
        int tmp;
        long c = a;
        c *= b;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return (int)(c/b);
    } int tmp; tmp long c = a; c a c *= b c b while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        } (tmp = a%b) != 0 (tmp = a%b) tmp a%b a b 0 {
            a = b;
            b = tmp;
        } a = b a b b = tmp b tmp return (int)(c/b); (int)(c/b) c b int a a int b b public class Main{
    public static Scanner scan  = new Scanner(System.in);
    public static void main(String[]args){
        int x = nextInt();
        int n = nextInt();

        if(n==0){
            print(x);
            System.exit(0);
        }

        boolean flag;
        flag = true;
        int[] arr = new int[n];

        int min,min_i,tmp;
        min = 1000;
        min_i = 1000;
        for(int i=0;i<n;i++){
            arr[i] = nextInt();
        }
        for(int a:arr){
            if(x==a){
                flag = false;
            }
        }
        if(flag){
            print(x);
            System.exit(0);
        }

        for(int i=1;i<101;i++){
            flag = true;
            tmp = x-i;
            for(int a:arr){
                if(a!=tmp){
                    flag=true;
                    min = tmp;
                }
                else{
                    flag = false;
                    break;
                }
            }
            if(flag){
                print(min);
                System.exit(0);
            }

            flag = true;
            tmp = x+i;
            for(int a:arr){
                if(a!=tmp){
                    flag=true;
                    min = tmp;
                }
                else{
                    flag = false;
                    break;
                }
            }
            if(flag){
                print(min);
                System.exit(0);
            }

        }
    }

    public static int nextInt(){
        return Integer.parseInt(scan.next());
    }
    public static long nextLong(){
        return Long.parseLong(scan.next());
    }
    public static String next(){
        return scan.next();
    }
    public static double nextDouble(){
        return Double.parseDouble(scan.next());
    }
    public static float nextFloat(){
        return Float.parseFloat(scan.next());
    }

    //Yes or No
    public static void yesNo(boolean flag){
        if(flag) System.out.println("Yes");
        else System.out.println("No");
    }

    //print
    public static void print(Object a){
        System.out.println(a);
    }


    //gcd
    public static int gcd (int a, int b){
        int tmp;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return b;
    }


    //lcm
    public static int lcm(int a,int b){
        int tmp;
        long c = a;
        c *= b;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return (int)(c/b);
    }
} public class Main{
    public static Scanner scan  = new Scanner(System.in);
    public static void main(String[]args){
        int x = nextInt();
        int n = nextInt();

        if(n==0){
            print(x);
            System.exit(0);
        }

        boolean flag;
        flag = true;
        int[] arr = new int[n];

        int min,min_i,tmp;
        min = 1000;
        min_i = 1000;
        for(int i=0;i<n;i++){
            arr[i] = nextInt();
        }
        for(int a:arr){
            if(x==a){
                flag = false;
            }
        }
        if(flag){
            print(x);
            System.exit(0);
        }

        for(int i=1;i<101;i++){
            flag = true;
            tmp = x-i;
            for(int a:arr){
                if(a!=tmp){
                    flag=true;
                    min = tmp;
                }
                else{
                    flag = false;
                    break;
                }
            }
            if(flag){
                print(min);
                System.exit(0);
            }

            flag = true;
            tmp = x+i;
            for(int a:arr){
                if(a!=tmp){
                    flag=true;
                    min = tmp;
                }
                else{
                    flag = false;
                    break;
                }
            }
            if(flag){
                print(min);
                System.exit(0);
            }

        }
    }

    public static int nextInt(){
        return Integer.parseInt(scan.next());
    }
    public static long nextLong(){
        return Long.parseLong(scan.next());
    }
    public static String next(){
        return scan.next();
    }
    public static double nextDouble(){
        return Double.parseDouble(scan.next());
    }
    public static float nextFloat(){
        return Float.parseFloat(scan.next());
    }

    //Yes or No
    public static void yesNo(boolean flag){
        if(flag) System.out.println("Yes");
        else System.out.println("No");
    }

    //print
    public static void print(Object a){
        System.out.println(a);
    }


    //gcd
    public static int gcd (int a, int b){
        int tmp;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return b;
    }


    //lcm
    public static int lcm(int a,int b){
        int tmp;
        long c = a;
        c *= b;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return (int)(c/b);
    }
} Main
import java.util.Scanner;


public class Main{
    public static Scanner scan  = new Scanner(System.in);
    public static void main(String[]args){
        int x = nextInt();
        int n = nextInt();

        if(n==0){
            print(x);
            System.exit(0);
        }

        boolean flag;
        flag = true;
        int[] arr = new int[n];

        int min,min_i,tmp;
        min = 1000;
        min_i = 1000;
        for(int i=0;i<n;i++){
            arr[i] = nextInt();
        }
        for(int a:arr){
            if(x==a){
                flag = false;
            }
        }
        if(flag){
            print(x);
            System.exit(0);
        }

        for(int i=1;i<101;i++){
            flag = true;
            tmp = x-i;
            for(int a:arr){
                if(a!=tmp){
                    flag=true;
                    min = tmp;
                }
                else{
                    flag = false;
                    break;
                }
            }
            if(flag){
                print(min);
                System.exit(0);
            }

            flag = true;
            tmp = x+i;
            for(int a:arr){
                if(a!=tmp){
                    flag=true;
                    min = tmp;
                }
                else{
                    flag = false;
                    break;
                }
            }
            if(flag){
                print(min);
                System.exit(0);
            }

        }
    }

    public static int nextInt(){
        return Integer.parseInt(scan.next());
    }
    public static long nextLong(){
        return Long.parseLong(scan.next());
    }
    public static String next(){
        return scan.next();
    }
    public static double nextDouble(){
        return Double.parseDouble(scan.next());
    }
    public static float nextFloat(){
        return Float.parseFloat(scan.next());
    }

    //Yes or No
    public static void yesNo(boolean flag){
        if(flag) System.out.println("Yes");
        else System.out.println("No");
    }

    //print
    public static void print(Object a){
        System.out.println(a);
    }


    //gcd
    public static int gcd (int a, int b){
        int tmp;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return b;
    }


    //lcm
    public static int lcm(int a,int b){
        int tmp;
        long c = a;
        c *= b;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return (int)(c/b);
    }
}