import java.util.Scanner; 


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
        int[] p = new int[N];
        int[] px = new int[101];
        int[] nx = new int[101];
        int[] dpx = new int[N];
        int[] dnx = new int[N];
        int cp = 0;
        int cn = 0;
        for (int i = 0; i < N; i++) {
            p[i] = sc.nextInt();
        }
        for (int i = 0 ; i < 101; i++) {
            px[i] = X + i;
            nx[i] = X - i;
            for (int j = 0; j < N; j++) {
                dpx[j] = px[i] - p[j];
                dnx[j] = nx[i] - p[j];
                if (dpx[j] == 0) {
                    cp = cp;
                } else {
                    cp = cp+1;
                }
                if (dnx[j] == 0) {
                    cn = cn;
                } else {
                    cn =cn + 1;
                }
            }
            if ( cp == N && cn == N) {
                System.out.println(Math.min(px[i],nx[i]));
                break;
            } else if (cp == N && cn != N){
                System.out.println(px[i]);
                break;
            } else if (cn == N && cp != N) {
                System.out.println(nx[i]);
                break;
            } else {
                cp = 0;
                cn = 0;
            }
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
        int[] p = new int[N];
        int[] px = new int[101];
        int[] nx = new int[101];
        int[] dpx = new int[N];
        int[] dnx = new int[N];
        int cp = 0;
        int cn = 0;
        for (int i = 0; i < N; i++) {
            p[i] = sc.nextInt();
        }
        for (int i = 0 ; i < 101; i++) {
            px[i] = X + i;
            nx[i] = X - i;
            for (int j = 0; j < N; j++) {
                dpx[j] = px[i] - p[j];
                dnx[j] = nx[i] - p[j];
                if (dpx[j] == 0) {
                    cp = cp;
                } else {
                    cp = cp+1;
                }
                if (dnx[j] == 0) {
                    cn = cn;
                } else {
                    cn =cn + 1;
                }
            }
            if ( cp == N && cn == N) {
                System.out.println(Math.min(px[i],nx[i]));
                break;
            } else if (cp == N && cn != N){
                System.out.println(px[i]);
                break;
            } else if (cn == N && cp != N) {
                System.out.println(nx[i]);
                break;
            } else {
                cp = 0;
                cn = 0;
            }
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
        int[] p = new int[N];
        int[] px = new int[101];
        int[] nx = new int[101];
        int[] dpx = new int[N];
        int[] dnx = new int[N];
        int cp = 0;
        int cn = 0;
        for (int i = 0; i < N; i++) {
            p[i] = sc.nextInt();
        }
        for (int i = 0 ; i < 101; i++) {
            px[i] = X + i;
            nx[i] = X - i;
            for (int j = 0; j < N; j++) {
                dpx[j] = px[i] - p[j];
                dnx[j] = nx[i] - p[j];
                if (dpx[j] == 0) {
                    cp = cp;
                } else {
                    cp = cp+1;
                }
                if (dnx[j] == 0) {
                    cn = cn;
                } else {
                    cn =cn + 1;
                }
            }
            if ( cp == N && cn == N) {
                System.out.println(Math.min(px[i],nx[i]));
                break;
            } else if (cp == N && cn != N){
                System.out.println(px[i]);
                break;
            } else if (cn == N && cp != N) {
                System.out.println(nx[i]);
                break;
            } else {
                cp = 0;
                cn = 0;
            }
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
        int[] p = new int[N];
        int[] px = new int[101];
        int[] nx = new int[101];
        int[] dpx = new int[N];
        int[] dnx = new int[N];
        int cp = 0;
        int cn = 0;
        for (int i = 0; i < N; i++) {
            p[i] = sc.nextInt();
        }
        for (int i = 0 ; i < 101; i++) {
            px[i] = X + i;
            nx[i] = X - i;
            for (int j = 0; j < N; j++) {
                dpx[j] = px[i] - p[j];
                dnx[j] = nx[i] - p[j];
                if (dpx[j] == 0) {
                    cp = cp;
                } else {
                    cp = cp+1;
                }
                if (dnx[j] == 0) {
                    cn = cn;
                } else {
                    cn =cn + 1;
                }
            }
            if ( cp == N && cn == N) {
                System.out.println(Math.min(px[i],nx[i]));
                break;
            } else if (cp == N && cn != N){
                System.out.println(px[i]);
                break;
            } else if (cn == N && cp != N) {
                System.out.println(nx[i]);
                break;
            } else {
                cp = 0;
                cn = 0;
            }
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int X = sc.nextInt(); X sc.nextInt() sc.nextInt sc int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] p = new int[N]; p new int[N] N int[] px = new int[101]; px new int[101] 101 int[] nx = new int[101]; nx new int[101] 101 int[] dpx = new int[N]; dpx new int[N] N int[] dnx = new int[N]; dnx new int[N] N int cp = 0; cp 0 int cn = 0; cn 0 for (int i = 0; i < N; i++) {
            p[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            p[i] = sc.nextInt();
        } {
            p[i] = sc.nextInt();
        } p[i] = sc.nextInt() p[i] p i sc.nextInt() sc.nextInt sc for (int i = 0 ; i < 101; i++) {
            px[i] = X + i;
            nx[i] = X - i;
            for (int j = 0; j < N; j++) {
                dpx[j] = px[i] - p[j];
                dnx[j] = nx[i] - p[j];
                if (dpx[j] == 0) {
                    cp = cp;
                } else {
                    cp = cp+1;
                }
                if (dnx[j] == 0) {
                    cn = cn;
                } else {
                    cn =cn + 1;
                }
            }
            if ( cp == N && cn == N) {
                System.out.println(Math.min(px[i],nx[i]));
                break;
            } else if (cp == N && cn != N){
                System.out.println(px[i]);
                break;
            } else if (cn == N && cp != N) {
                System.out.println(nx[i]);
                break;
            } else {
                cp = 0;
                cn = 0;
            }
        } int i = 0 ; int i = 0 ; i 0 i < 101 i 101 i++ i++ i {
            px[i] = X + i;
            nx[i] = X - i;
            for (int j = 0; j < N; j++) {
                dpx[j] = px[i] - p[j];
                dnx[j] = nx[i] - p[j];
                if (dpx[j] == 0) {
                    cp = cp;
                } else {
                    cp = cp+1;
                }
                if (dnx[j] == 0) {
                    cn = cn;
                } else {
                    cn =cn + 1;
                }
            }
            if ( cp == N && cn == N) {
                System.out.println(Math.min(px[i],nx[i]));
                break;
            } else if (cp == N && cn != N){
                System.out.println(px[i]);
                break;
            } else if (cn == N && cp != N) {
                System.out.println(nx[i]);
                break;
            } else {
                cp = 0;
                cn = 0;
            }
        } {
            px[i] = X + i;
            nx[i] = X - i;
            for (int j = 0; j < N; j++) {
                dpx[j] = px[i] - p[j];
                dnx[j] = nx[i] - p[j];
                if (dpx[j] == 0) {
                    cp = cp;
                } else {
                    cp = cp+1;
                }
                if (dnx[j] == 0) {
                    cn = cn;
                } else {
                    cn =cn + 1;
                }
            }
            if ( cp == N && cn == N) {
                System.out.println(Math.min(px[i],nx[i]));
                break;
            } else if (cp == N && cn != N){
                System.out.println(px[i]);
                break;
            } else if (cn == N && cp != N) {
                System.out.println(nx[i]);
                break;
            } else {
                cp = 0;
                cn = 0;
            }
        } px[i] = X + i px[i] px i X + i X i nx[i] = X - i nx[i] nx i X - i X i for (int j = 0; j < N; j++) {
                dpx[j] = px[i] - p[j];
                dnx[j] = nx[i] - p[j];
                if (dpx[j] == 0) {
                    cp = cp;
                } else {
                    cp = cp+1;
                }
                if (dnx[j] == 0) {
                    cn = cn;
                } else {
                    cn =cn + 1;
                }
            } int j = 0; int j = 0; j 0 j < N j N j++ j++ j {
                dpx[j] = px[i] - p[j];
                dnx[j] = nx[i] - p[j];
                if (dpx[j] == 0) {
                    cp = cp;
                } else {
                    cp = cp+1;
                }
                if (dnx[j] == 0) {
                    cn = cn;
                } else {
                    cn =cn + 1;
                }
            } {
                dpx[j] = px[i] - p[j];
                dnx[j] = nx[i] - p[j];
                if (dpx[j] == 0) {
                    cp = cp;
                } else {
                    cp = cp+1;
                }
                if (dnx[j] == 0) {
                    cn = cn;
                } else {
                    cn =cn + 1;
                }
            } dpx[j] = px[i] - p[j] dpx[j] dpx j px[i] - p[j] px[i] px i p[j] p j dnx[j] = nx[i] - p[j] dnx[j] dnx j nx[i] - p[j] nx[i] nx i p[j] p j if (dpx[j] == 0) {
                    cp = cp;
                } else {
                    cp = cp+1;
                } dpx[j] == 0 dpx[j] dpx j 0 {
                    cp = cp;
                } cp = cp cp cp {
                    cp = cp+1;
                } cp = cp+1 cp cp+1 cp 1 if (dnx[j] == 0) {
                    cn = cn;
                } else {
                    cn =cn + 1;
                } dnx[j] == 0 dnx[j] dnx j 0 {
                    cn = cn;
                } cn = cn cn cn {
                    cn =cn + 1;
                } cn =cn + 1 cn cn + 1 cn 1 if ( cp == N && cn == N) {
                System.out.println(Math.min(px[i],nx[i]));
                break;
            } else if (cp == N && cn != N){
                System.out.println(px[i]);
                break;
            } else if (cn == N && cp != N) {
                System.out.println(nx[i]);
                break;
            } else {
                cp = 0;
                cn = 0;
            } cp == N && cn == N cp == N cp N cn == N cn N {
                System.out.println(Math.min(px[i],nx[i]));
                break;
            } System.out.println(Math.min(px[i],nx[i])) System.out.println System.out System System.out Math.min(px[i],nx[i]) Math.min Math px[i] px i nx[i] nx i break; if (cp == N && cn != N){
                System.out.println(px[i]);
                break;
            } else if (cn == N && cp != N) {
                System.out.println(nx[i]);
                break;
            } else {
                cp = 0;
                cn = 0;
            } cp == N && cn != N cp == N cp N cn != N cn N {
                System.out.println(px[i]);
                break;
            } System.out.println(px[i]) System.out.println System.out System System.out px[i] px i break; if (cn == N && cp != N) {
                System.out.println(nx[i]);
                break;
            } else {
                cp = 0;
                cn = 0;
            } cn == N && cp != N cn == N cn N cp != N cp N {
                System.out.println(nx[i]);
                break;
            } System.out.println(nx[i]) System.out.println System.out System System.out nx[i] nx i break; {
                cp = 0;
                cn = 0;
            } cp = 0 cp 0 cn = 0 cn 0 String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
        int[] p = new int[N];
        int[] px = new int[101];
        int[] nx = new int[101];
        int[] dpx = new int[N];
        int[] dnx = new int[N];
        int cp = 0;
        int cn = 0;
        for (int i = 0; i < N; i++) {
            p[i] = sc.nextInt();
        }
        for (int i = 0 ; i < 101; i++) {
            px[i] = X + i;
            nx[i] = X - i;
            for (int j = 0; j < N; j++) {
                dpx[j] = px[i] - p[j];
                dnx[j] = nx[i] - p[j];
                if (dpx[j] == 0) {
                    cp = cp;
                } else {
                    cp = cp+1;
                }
                if (dnx[j] == 0) {
                    cn = cn;
                } else {
                    cn =cn + 1;
                }
            }
            if ( cp == N && cn == N) {
                System.out.println(Math.min(px[i],nx[i]));
                break;
            } else if (cp == N && cn != N){
                System.out.println(px[i]);
                break;
            } else if (cn == N && cp != N) {
                System.out.println(nx[i]);
                break;
            } else {
                cp = 0;
                cn = 0;
            }
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
        int[] p = new int[N];
        int[] px = new int[101];
        int[] nx = new int[101];
        int[] dpx = new int[N];
        int[] dnx = new int[N];
        int cp = 0;
        int cn = 0;
        for (int i = 0; i < N; i++) {
            p[i] = sc.nextInt();
        }
        for (int i = 0 ; i < 101; i++) {
            px[i] = X + i;
            nx[i] = X - i;
            for (int j = 0; j < N; j++) {
                dpx[j] = px[i] - p[j];
                dnx[j] = nx[i] - p[j];
                if (dpx[j] == 0) {
                    cp = cp;
                } else {
                    cp = cp+1;
                }
                if (dnx[j] == 0) {
                    cn = cn;
                } else {
                    cn =cn + 1;
                }
            }
            if ( cp == N && cn == N) {
                System.out.println(Math.min(px[i],nx[i]));
                break;
            } else if (cp == N && cn != N){
                System.out.println(px[i]);
                break;
            } else if (cn == N && cp != N) {
                System.out.println(nx[i]);
                break;
            } else {
                cp = 0;
                cn = 0;
            }
        }
    }
} Main
import java.util.Scanner; 


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
        int[] p = new int[N];
        int[] px = new int[101];
        int[] nx = new int[101];
        int[] dpx = new int[N];
        int[] dnx = new int[N];
        int cp = 0;
        int cn = 0;
        for (int i = 0; i < N; i++) {
            p[i] = sc.nextInt();
        }
        for (int i = 0 ; i < 101; i++) {
            px[i] = X + i;
            nx[i] = X - i;
            for (int j = 0; j < N; j++) {
                dpx[j] = px[i] - p[j];
                dnx[j] = nx[i] - p[j];
                if (dpx[j] == 0) {
                    cp = cp;
                } else {
                    cp = cp+1;
                }
                if (dnx[j] == 0) {
                    cn = cn;
                } else {
                    cn =cn + 1;
                }
            }
            if ( cp == N && cn == N) {
                System.out.println(Math.min(px[i],nx[i]));
                break;
            } else if (cp == N && cn != N){
                System.out.println(px[i]);
                break;
            } else if (cn == N && cp != N) {
                System.out.println(nx[i]);
                break;
            } else {
                cp = 0;
                cn = 0;
            }
        }
    }
}