import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.lang.Math;
import java.util.Map;

public class Main {

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int x = fs.nextInt();
        int n = fs.nextInt();
        int[] ar = fs.readArray(n);

        for (int i = 0; i<100; i++) {
            boolean dec = inArray(ar,x-i,n);
            boolean inc = inArray(ar,x+i,n);
            if (dec == true && inc == true) {
                System.out.println(x-i);
                break;
            } else if (dec==true) {
                System.out.println(x-i);
                break;
            } else if (inc == true) {
                System.out.println(x+i);
                break;
            } else {
                continue;
            }

        }
    }
    public static boolean inArray(int[] ar, int x, int n) {

        for (int i = 0; i<n; i++) {
            if (x==ar[i]) {
                return false;
            }
        }
        return true;

    }


    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");

        public String next() {
            while (!st.hasMoreElements())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] readArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }
    }

}
 import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.*; util.* java import java.lang.Math; Math java.lang import java.util.Map; Map java.util public class Main {

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int x = fs.nextInt();
        int n = fs.nextInt();
        int[] ar = fs.readArray(n);

        for (int i = 0; i<100; i++) {
            boolean dec = inArray(ar,x-i,n);
            boolean inc = inArray(ar,x+i,n);
            if (dec == true && inc == true) {
                System.out.println(x-i);
                break;
            } else if (dec==true) {
                System.out.println(x-i);
                break;
            } else if (inc == true) {
                System.out.println(x+i);
                break;
            } else {
                continue;
            }

        }
    }
    public static boolean inArray(int[] ar, int x, int n) {

        for (int i = 0; i<n; i++) {
            if (x==ar[i]) {
                return false;
            }
        }
        return true;

    }


    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");

        public String next() {
            while (!st.hasMoreElements())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] readArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }
    }

} Main public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int x = fs.nextInt();
        int n = fs.nextInt();
        int[] ar = fs.readArray(n);

        for (int i = 0; i<100; i++) {
            boolean dec = inArray(ar,x-i,n);
            boolean inc = inArray(ar,x+i,n);
            if (dec == true && inc == true) {
                System.out.println(x-i);
                break;
            } else if (dec==true) {
                System.out.println(x-i);
                break;
            } else if (inc == true) {
                System.out.println(x+i);
                break;
            } else {
                continue;
            }

        }
    } main {
        FastScanner fs = new FastScanner();
        int x = fs.nextInt();
        int n = fs.nextInt();
        int[] ar = fs.readArray(n);

        for (int i = 0; i<100; i++) {
            boolean dec = inArray(ar,x-i,n);
            boolean inc = inArray(ar,x+i,n);
            if (dec == true && inc == true) {
                System.out.println(x-i);
                break;
            } else if (dec==true) {
                System.out.println(x-i);
                break;
            } else if (inc == true) {
                System.out.println(x+i);
                break;
            } else {
                continue;
            }

        }
    } FastScanner fs = new FastScanner(); fs new FastScanner() int x = fs.nextInt(); x fs.nextInt() fs.nextInt fs int n = fs.nextInt(); n fs.nextInt() fs.nextInt fs int[] ar = fs.readArray(n); ar fs.readArray(n) fs.readArray fs n for (int i = 0; i<100; i++) {
            boolean dec = inArray(ar,x-i,n);
            boolean inc = inArray(ar,x+i,n);
            if (dec == true && inc == true) {
                System.out.println(x-i);
                break;
            } else if (dec==true) {
                System.out.println(x-i);
                break;
            } else if (inc == true) {
                System.out.println(x+i);
                break;
            } else {
                continue;
            }

        } int i = 0; int i = 0; i 0 i<100 i 100 i++ i++ i {
            boolean dec = inArray(ar,x-i,n);
            boolean inc = inArray(ar,x+i,n);
            if (dec == true && inc == true) {
                System.out.println(x-i);
                break;
            } else if (dec==true) {
                System.out.println(x-i);
                break;
            } else if (inc == true) {
                System.out.println(x+i);
                break;
            } else {
                continue;
            }

        } {
            boolean dec = inArray(ar,x-i,n);
            boolean inc = inArray(ar,x+i,n);
            if (dec == true && inc == true) {
                System.out.println(x-i);
                break;
            } else if (dec==true) {
                System.out.println(x-i);
                break;
            } else if (inc == true) {
                System.out.println(x+i);
                break;
            } else {
                continue;
            }

        } boolean dec = inArray(ar,x-i,n); dec inArray(ar,x-i,n) inArray ar x-i x i n boolean inc = inArray(ar,x+i,n); inc inArray(ar,x+i,n) inArray ar x+i x i n if (dec == true && inc == true) {
                System.out.println(x-i);
                break;
            } else if (dec==true) {
                System.out.println(x-i);
                break;
            } else if (inc == true) {
                System.out.println(x+i);
                break;
            } else {
                continue;
            } dec == true && inc == true dec == true dec true inc == true inc true {
                System.out.println(x-i);
                break;
            } System.out.println(x-i) System.out.println System.out System System.out x-i x i break; if (dec==true) {
                System.out.println(x-i);
                break;
            } else if (inc == true) {
                System.out.println(x+i);
                break;
            } else {
                continue;
            } dec==true dec true {
                System.out.println(x-i);
                break;
            } System.out.println(x-i) System.out.println System.out System System.out x-i x i break; if (inc == true) {
                System.out.println(x+i);
                break;
            } else {
                continue;
            } inc == true inc true {
                System.out.println(x+i);
                break;
            } System.out.println(x+i) System.out.println System.out System System.out x+i x i break; {
                continue;
            } continue; String[] args args public static boolean inArray(int[] ar, int x, int n) {

        for (int i = 0; i<n; i++) {
            if (x==ar[i]) {
                return false;
            }
        }
        return true;

    } inArray {

        for (int i = 0; i<n; i++) {
            if (x==ar[i]) {
                return false;
            }
        }
        return true;

    } for (int i = 0; i<n; i++) {
            if (x==ar[i]) {
                return false;
            }
        } int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
            if (x==ar[i]) {
                return false;
            }
        } {
            if (x==ar[i]) {
                return false;
            }
        } if (x==ar[i]) {
                return false;
            } x==ar[i] x ar[i] ar i {
                return false;
            } return false; false return true; true int[] ar ar int x x int n n static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");

        public String next() {
            while (!st.hasMoreElements())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] readArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }
    } FastScanner BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) StringTokenizer st=new StringTokenizer(""); st new StringTokenizer("") public String next() {
            while (!st.hasMoreElements())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        } next {
            while (!st.hasMoreElements())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        } while (!st.hasMoreElements())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                } !st.hasMoreElements() st.hasMoreElements() st.hasMoreElements st try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                } IOException e {
                    e.printStackTrace();
                } e.printStackTrace() e.printStackTrace e {
                    st=new StringTokenizer(br.readLine());
                } st=new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st int nextInt() {
            return Integer.parseInt(next());
        } nextInt {
            return Integer.parseInt(next());
        } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next int[] readArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        } readArray {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        } int[] a=new int[n]; a new int[n] n for (int i=0; i<n; i++) a[i]=nextInt(); int i=0; int i=0; i 0 i<n i n i++ i++ i a[i]=nextInt(); a[i]=nextInt() a[i] a i nextInt() nextInt return a; a int n n public class Main {

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int x = fs.nextInt();
        int n = fs.nextInt();
        int[] ar = fs.readArray(n);

        for (int i = 0; i<100; i++) {
            boolean dec = inArray(ar,x-i,n);
            boolean inc = inArray(ar,x+i,n);
            if (dec == true && inc == true) {
                System.out.println(x-i);
                break;
            } else if (dec==true) {
                System.out.println(x-i);
                break;
            } else if (inc == true) {
                System.out.println(x+i);
                break;
            } else {
                continue;
            }

        }
    }
    public static boolean inArray(int[] ar, int x, int n) {

        for (int i = 0; i<n; i++) {
            if (x==ar[i]) {
                return false;
            }
        }
        return true;

    }


    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");

        public String next() {
            while (!st.hasMoreElements())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] readArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }
    }

} public class Main {

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int x = fs.nextInt();
        int n = fs.nextInt();
        int[] ar = fs.readArray(n);

        for (int i = 0; i<100; i++) {
            boolean dec = inArray(ar,x-i,n);
            boolean inc = inArray(ar,x+i,n);
            if (dec == true && inc == true) {
                System.out.println(x-i);
                break;
            } else if (dec==true) {
                System.out.println(x-i);
                break;
            } else if (inc == true) {
                System.out.println(x+i);
                break;
            } else {
                continue;
            }

        }
    }
    public static boolean inArray(int[] ar, int x, int n) {

        for (int i = 0; i<n; i++) {
            if (x==ar[i]) {
                return false;
            }
        }
        return true;

    }


    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");

        public String next() {
            while (!st.hasMoreElements())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] readArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }
    }

} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.lang.Math;
import java.util.Map;

public class Main {

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int x = fs.nextInt();
        int n = fs.nextInt();
        int[] ar = fs.readArray(n);

        for (int i = 0; i<100; i++) {
            boolean dec = inArray(ar,x-i,n);
            boolean inc = inArray(ar,x+i,n);
            if (dec == true && inc == true) {
                System.out.println(x-i);
                break;
            } else if (dec==true) {
                System.out.println(x-i);
                break;
            } else if (inc == true) {
                System.out.println(x+i);
                break;
            } else {
                continue;
            }

        }
    }
    public static boolean inArray(int[] ar, int x, int n) {

        for (int i = 0; i<n; i++) {
            if (x==ar[i]) {
                return false;
            }
        }
        return true;

    }


    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");

        public String next() {
            while (!st.hasMoreElements())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] readArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }
    }

}

