import java.util.HashSet;
import java.util.Scanner;

public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt(),N = sc.nextInt();
        int min = 114514893;
        int ans = -1;
        HashSet<Integer> set = new HashSet<Integer>();
        for(int i=0;i<N;i++){
            int temp = sc.nextInt();
            set.add(temp);
        }
        for(int i=-200;i<=200;i++){
            if(set.contains(i)){
                continue;
            }
            if(Math.abs(i-X)<min){
                min = Math.abs(i-X);
                ans = i;
            }else if(Math.abs(i-X)==min&&i<ans){
                //System.out.println(ans+"ss"+i);
                ans = i;
            }
        }
        System.out.println(ans);

    }
} import java.util.HashSet; HashSet java.util 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(),N = sc.nextInt();
        int min = 114514893;
        int ans = -1;
        HashSet<Integer> set = new HashSet<Integer>();
        for(int i=0;i<N;i++){
            int temp = sc.nextInt();
            set.add(temp);
        }
        for(int i=-200;i<=200;i++){
            if(set.contains(i)){
                continue;
            }
            if(Math.abs(i-X)<min){
                min = Math.abs(i-X);
                ans = i;
            }else if(Math.abs(i-X)==min&&i<ans){
                //System.out.println(ans+"ss"+i);
                ans = i;
            }
        }
        System.out.println(ans);

    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt(),N = sc.nextInt();
        int min = 114514893;
        int ans = -1;
        HashSet<Integer> set = new HashSet<Integer>();
        for(int i=0;i<N;i++){
            int temp = sc.nextInt();
            set.add(temp);
        }
        for(int i=-200;i<=200;i++){
            if(set.contains(i)){
                continue;
            }
            if(Math.abs(i-X)<min){
                min = Math.abs(i-X);
                ans = i;
            }else if(Math.abs(i-X)==min&&i<ans){
                //System.out.println(ans+"ss"+i);
                ans = i;
            }
        }
        System.out.println(ans);

    } main {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt(),N = sc.nextInt();
        int min = 114514893;
        int ans = -1;
        HashSet<Integer> set = new HashSet<Integer>();
        for(int i=0;i<N;i++){
            int temp = sc.nextInt();
            set.add(temp);
        }
        for(int i=-200;i<=200;i++){
            if(set.contains(i)){
                continue;
            }
            if(Math.abs(i-X)<min){
                min = Math.abs(i-X);
                ans = i;
            }else if(Math.abs(i-X)==min&&i<ans){
                //System.out.println(ans+"ss"+i);
                ans = i;
            }
        }
        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 N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int min = 114514893; min 114514893 int ans = -1; ans -1 1 HashSet<Integer> set = new HashSet<Integer>(); set new HashSet<Integer>() for(int i=0;i<N;i++){
            int temp = sc.nextInt();
            set.add(temp);
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            int temp = sc.nextInt();
            set.add(temp);
        } {
            int temp = sc.nextInt();
            set.add(temp);
        } int temp = sc.nextInt(); temp sc.nextInt() sc.nextInt sc set.add(temp) set.add set temp for(int i=-200;i<=200;i++){
            if(set.contains(i)){
                continue;
            }
            if(Math.abs(i-X)<min){
                min = Math.abs(i-X);
                ans = i;
            }else if(Math.abs(i-X)==min&&i<ans){
                //System.out.println(ans+"ss"+i);
                ans = i;
            }
        } int i=-200; int i=-200; i -200 200 i<=200 i 200 i++ i++ i {
            if(set.contains(i)){
                continue;
            }
            if(Math.abs(i-X)<min){
                min = Math.abs(i-X);
                ans = i;
            }else if(Math.abs(i-X)==min&&i<ans){
                //System.out.println(ans+"ss"+i);
                ans = i;
            }
        } {
            if(set.contains(i)){
                continue;
            }
            if(Math.abs(i-X)<min){
                min = Math.abs(i-X);
                ans = i;
            }else if(Math.abs(i-X)==min&&i<ans){
                //System.out.println(ans+"ss"+i);
                ans = i;
            }
        } if(set.contains(i)){
                continue;
            } set.contains(i) set.contains set i {
                continue;
            } continue; if(Math.abs(i-X)<min){
                min = Math.abs(i-X);
                ans = i;
            }else if(Math.abs(i-X)==min&&i<ans){
                //System.out.println(ans+"ss"+i);
                ans = i;
            } Math.abs(i-X)<min Math.abs(i-X) Math.abs Math i-X i X min {
                min = Math.abs(i-X);
                ans = i;
            } min = Math.abs(i-X) min Math.abs(i-X) Math.abs Math i-X i X ans = i ans i if(Math.abs(i-X)==min&&i<ans){
                //System.out.println(ans+"ss"+i);
                ans = i;
            } Math.abs(i-X)==min&&i<ans Math.abs(i-X)==min Math.abs(i-X) Math.abs Math i-X i X min i<ans i ans {
                //System.out.println(ans+"ss"+i);
                ans = i;
            } ans = i ans i 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(),N = sc.nextInt();
        int min = 114514893;
        int ans = -1;
        HashSet<Integer> set = new HashSet<Integer>();
        for(int i=0;i<N;i++){
            int temp = sc.nextInt();
            set.add(temp);
        }
        for(int i=-200;i<=200;i++){
            if(set.contains(i)){
                continue;
            }
            if(Math.abs(i-X)<min){
                min = Math.abs(i-X);
                ans = i;
            }else if(Math.abs(i-X)==min&&i<ans){
                //System.out.println(ans+"ss"+i);
                ans = i;
            }
        }
        System.out.println(ans);

    }
} public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt(),N = sc.nextInt();
        int min = 114514893;
        int ans = -1;
        HashSet<Integer> set = new HashSet<Integer>();
        for(int i=0;i<N;i++){
            int temp = sc.nextInt();
            set.add(temp);
        }
        for(int i=-200;i<=200;i++){
            if(set.contains(i)){
                continue;
            }
            if(Math.abs(i-X)<min){
                min = Math.abs(i-X);
                ans = i;
            }else if(Math.abs(i-X)==min&&i<ans){
                //System.out.println(ans+"ss"+i);
                ans = i;
            }
        }
        System.out.println(ans);

    }
} Main
import java.util.HashSet;
import java.util.Scanner;

public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt(),N = sc.nextInt();
        int min = 114514893;
        int ans = -1;
        HashSet<Integer> set = new HashSet<Integer>();
        for(int i=0;i<N;i++){
            int temp = sc.nextInt();
            set.add(temp);
        }
        for(int i=-200;i<=200;i++){
            if(set.contains(i)){
                continue;
            }
            if(Math.abs(i-X)<min){
                min = Math.abs(i-X);
                ans = i;
            }else if(Math.abs(i-X)==min&&i<ans){
                //System.out.println(ans+"ss"+i);
                ans = i;
            }
        }
        System.out.println(ans);

    }
}
