
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        int x = scn.nextInt();
        int n = scn.nextInt();
        String[] p = new String[n];
        for(int i=0;i<n;i++){
            p[i]=scn.next();
        }
        for(int j=0;j<=51;j++){
            int min = x-j;
            int max = x+j;
            String mi = String.valueOf(min);
            String ma = String.valueOf(max);

            if(!Arrays.asList(p).contains(mi)){
                System.out.println(x-j);
                return;
            }
            if(!Arrays.asList(p).contains(ma)){
                System.out.println(x+j);
                return;
            }

        }
        scn.close();

    }

} import java.util.*; util.* java public class Main {
    public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        int x = scn.nextInt();
        int n = scn.nextInt();
        String[] p = new String[n];
        for(int i=0;i<n;i++){
            p[i]=scn.next();
        }
        for(int j=0;j<=51;j++){
            int min = x-j;
            int max = x+j;
            String mi = String.valueOf(min);
            String ma = String.valueOf(max);

            if(!Arrays.asList(p).contains(mi)){
                System.out.println(x-j);
                return;
            }
            if(!Arrays.asList(p).contains(ma)){
                System.out.println(x+j);
                return;
            }

        }
        scn.close();

    }

} Main public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        int x = scn.nextInt();
        int n = scn.nextInt();
        String[] p = new String[n];
        for(int i=0;i<n;i++){
            p[i]=scn.next();
        }
        for(int j=0;j<=51;j++){
            int min = x-j;
            int max = x+j;
            String mi = String.valueOf(min);
            String ma = String.valueOf(max);

            if(!Arrays.asList(p).contains(mi)){
                System.out.println(x-j);
                return;
            }
            if(!Arrays.asList(p).contains(ma)){
                System.out.println(x+j);
                return;
            }

        }
        scn.close();

    } main {
        Scanner scn = new Scanner(System.in);
        int x = scn.nextInt();
        int n = scn.nextInt();
        String[] p = new String[n];
        for(int i=0;i<n;i++){
            p[i]=scn.next();
        }
        for(int j=0;j<=51;j++){
            int min = x-j;
            int max = x+j;
            String mi = String.valueOf(min);
            String ma = String.valueOf(max);

            if(!Arrays.asList(p).contains(mi)){
                System.out.println(x-j);
                return;
            }
            if(!Arrays.asList(p).contains(ma)){
                System.out.println(x+j);
                return;
            }

        }
        scn.close();

    } Scanner scn = new Scanner(System.in); scn new Scanner(System.in) int x = scn.nextInt(); x scn.nextInt() scn.nextInt scn int n = scn.nextInt(); n scn.nextInt() scn.nextInt scn String[] p = new String[n]; p new String[n] n for(int i=0;i<n;i++){
            p[i]=scn.next();
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            p[i]=scn.next();
        } {
            p[i]=scn.next();
        } p[i]=scn.next() p[i] p i scn.next() scn.next scn for(int j=0;j<=51;j++){
            int min = x-j;
            int max = x+j;
            String mi = String.valueOf(min);
            String ma = String.valueOf(max);

            if(!Arrays.asList(p).contains(mi)){
                System.out.println(x-j);
                return;
            }
            if(!Arrays.asList(p).contains(ma)){
                System.out.println(x+j);
                return;
            }

        } int j=0; int j=0; j 0 j<=51 j 51 j++ j++ j {
            int min = x-j;
            int max = x+j;
            String mi = String.valueOf(min);
            String ma = String.valueOf(max);

            if(!Arrays.asList(p).contains(mi)){
                System.out.println(x-j);
                return;
            }
            if(!Arrays.asList(p).contains(ma)){
                System.out.println(x+j);
                return;
            }

        } {
            int min = x-j;
            int max = x+j;
            String mi = String.valueOf(min);
            String ma = String.valueOf(max);

            if(!Arrays.asList(p).contains(mi)){
                System.out.println(x-j);
                return;
            }
            if(!Arrays.asList(p).contains(ma)){
                System.out.println(x+j);
                return;
            }

        } int min = x-j; min x-j x j int max = x+j; max x+j x j String mi = String.valueOf(min); mi String.valueOf(min) String.valueOf String min String ma = String.valueOf(max); ma String.valueOf(max) String.valueOf String max if(!Arrays.asList(p).contains(mi)){
                System.out.println(x-j);
                return;
            } !Arrays.asList(p).contains(mi) Arrays.asList(p).contains(mi) Arrays.asList(p).contains Arrays.asList(p) Arrays.asList Arrays p mi {
                System.out.println(x-j);
                return;
            } System.out.println(x-j) System.out.println System.out System System.out x-j x j return; if(!Arrays.asList(p).contains(ma)){
                System.out.println(x+j);
                return;
            } !Arrays.asList(p).contains(ma) Arrays.asList(p).contains(ma) Arrays.asList(p).contains Arrays.asList(p) Arrays.asList Arrays p ma {
                System.out.println(x+j);
                return;
            } System.out.println(x+j) System.out.println System.out System System.out x+j x j return; scn.close() scn.close scn String args[] args public class Main {
    public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        int x = scn.nextInt();
        int n = scn.nextInt();
        String[] p = new String[n];
        for(int i=0;i<n;i++){
            p[i]=scn.next();
        }
        for(int j=0;j<=51;j++){
            int min = x-j;
            int max = x+j;
            String mi = String.valueOf(min);
            String ma = String.valueOf(max);

            if(!Arrays.asList(p).contains(mi)){
                System.out.println(x-j);
                return;
            }
            if(!Arrays.asList(p).contains(ma)){
                System.out.println(x+j);
                return;
            }

        }
        scn.close();

    }

} public class Main {
    public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        int x = scn.nextInt();
        int n = scn.nextInt();
        String[] p = new String[n];
        for(int i=0;i<n;i++){
            p[i]=scn.next();
        }
        for(int j=0;j<=51;j++){
            int min = x-j;
            int max = x+j;
            String mi = String.valueOf(min);
            String ma = String.valueOf(max);

            if(!Arrays.asList(p).contains(mi)){
                System.out.println(x-j);
                return;
            }
            if(!Arrays.asList(p).contains(ma)){
                System.out.println(x+j);
                return;
            }

        }
        scn.close();

    }

} Main

import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        int x = scn.nextInt();
        int n = scn.nextInt();
        String[] p = new String[n];
        for(int i=0;i<n;i++){
            p[i]=scn.next();
        }
        for(int j=0;j<=51;j++){
            int min = x-j;
            int max = x+j;
            String mi = String.valueOf(min);
            String ma = String.valueOf(max);

            if(!Arrays.asList(p).contains(mi)){
                System.out.println(x-j);
                return;
            }
            if(!Arrays.asList(p).contains(ma)){
                System.out.println(x+j);
                return;
            }

        }
        scn.close();

    }

}