import 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();
        HashSet<Integer> set = new HashSet<Integer>();
        for (int i=0;i<N;i++) {
            int p = sc.nextInt();
            set.add(p);
        }

        int ans = X;
        if (set.contains(X)) {
            for (int i=1;i<200;i++) {
                if (!set.contains(X-i)) {
                    ans = X-i;
                    break;
                }
                if (!set.contains(X+i)) {
                    ans = X+i;
                    break;
                }
            }
        }
        System.out.println(ans);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
        HashSet<Integer> set = new HashSet<Integer>();
        for (int i=0;i<N;i++) {
            int p = sc.nextInt();
            set.add(p);
        }

        int ans = X;
        if (set.contains(X)) {
            for (int i=1;i<200;i++) {
                if (!set.contains(X-i)) {
                    ans = X-i;
                    break;
                }
                if (!set.contains(X+i)) {
                    ans = X+i;
                    break;
                }
            }
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
        HashSet<Integer> set = new HashSet<Integer>();
        for (int i=0;i<N;i++) {
            int p = sc.nextInt();
            set.add(p);
        }

        int ans = X;
        if (set.contains(X)) {
            for (int i=1;i<200;i++) {
                if (!set.contains(X-i)) {
                    ans = X-i;
                    break;
                }
                if (!set.contains(X+i)) {
                    ans = X+i;
                    break;
                }
            }
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
        HashSet<Integer> set = new HashSet<Integer>();
        for (int i=0;i<N;i++) {
            int p = sc.nextInt();
            set.add(p);
        }

        int ans = X;
        if (set.contains(X)) {
            for (int i=1;i<200;i++) {
                if (!set.contains(X-i)) {
                    ans = X-i;
                    break;
                }
                if (!set.contains(X+i)) {
                    ans = X+i;
                    break;
                }
            }
        }
        System.out.println(ans);
    } 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 HashSet<Integer> set = new HashSet<Integer>(); set new HashSet<Integer>() for (int i=0;i<N;i++) {
            int p = sc.nextInt();
            set.add(p);
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            int p = sc.nextInt();
            set.add(p);
        } {
            int p = sc.nextInt();
            set.add(p);
        } int p = sc.nextInt(); p sc.nextInt() sc.nextInt sc set.add(p) set.add set p int ans = X; ans X if (set.contains(X)) {
            for (int i=1;i<200;i++) {
                if (!set.contains(X-i)) {
                    ans = X-i;
                    break;
                }
                if (!set.contains(X+i)) {
                    ans = X+i;
                    break;
                }
            }
        } set.contains(X) set.contains set X {
            for (int i=1;i<200;i++) {
                if (!set.contains(X-i)) {
                    ans = X-i;
                    break;
                }
                if (!set.contains(X+i)) {
                    ans = X+i;
                    break;
                }
            }
        } for (int i=1;i<200;i++) {
                if (!set.contains(X-i)) {
                    ans = X-i;
                    break;
                }
                if (!set.contains(X+i)) {
                    ans = X+i;
                    break;
                }
            } int i=1; int i=1; i 1 i<200 i 200 i++ i++ i {
                if (!set.contains(X-i)) {
                    ans = X-i;
                    break;
                }
                if (!set.contains(X+i)) {
                    ans = X+i;
                    break;
                }
            } {
                if (!set.contains(X-i)) {
                    ans = X-i;
                    break;
                }
                if (!set.contains(X+i)) {
                    ans = X+i;
                    break;
                }
            } if (!set.contains(X-i)) {
                    ans = X-i;
                    break;
                } !set.contains(X-i) set.contains(X-i) set.contains set X-i X i {
                    ans = X-i;
                    break;
                } ans = X-i ans X-i X i break; if (!set.contains(X+i)) {
                    ans = X+i;
                    break;
                } !set.contains(X+i) set.contains(X+i) set.contains set X+i X i {
                    ans = X+i;
                    break;
                } ans = X+i ans X+i X i break; System.out.println(ans) System.out.println System.out System System.out ans 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();
        HashSet<Integer> set = new HashSet<Integer>();
        for (int i=0;i<N;i++) {
            int p = sc.nextInt();
            set.add(p);
        }

        int ans = X;
        if (set.contains(X)) {
            for (int i=1;i<200;i++) {
                if (!set.contains(X-i)) {
                    ans = X-i;
                    break;
                }
                if (!set.contains(X+i)) {
                    ans = X+i;
                    break;
                }
            }
        }
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
        HashSet<Integer> set = new HashSet<Integer>();
        for (int i=0;i<N;i++) {
            int p = sc.nextInt();
            set.add(p);
        }

        int ans = X;
        if (set.contains(X)) {
            for (int i=1;i<200;i++) {
                if (!set.contains(X-i)) {
                    ans = X-i;
                    break;
                }
                if (!set.contains(X+i)) {
                    ans = X+i;
                    break;
                }
            }
        }
        System.out.println(ans);
    }
} Main
import 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();
        HashSet<Integer> set = new HashSet<Integer>();
        for (int i=0;i<N;i++) {
            int p = sc.nextInt();
            set.add(p);
        }

        int ans = X;
        if (set.contains(X)) {
            for (int i=1;i<200;i++) {
                if (!set.contains(X-i)) {
                    ans = X-i;
                    break;
                }
                if (!set.contains(X+i)) {
                    ans = X+i;
                    break;
                }
            }
        }
        System.out.println(ans);
    }
}