import java.util.*;
import java.math.*;
public class Main {
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();
		
		List<Integer> arr = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            int d = sc.nextInt();
			arr.add(d);
            }
			
			if(!arr.contains(X))
			{System.out.println(X);}
		else{
		for(int i = 0; i < 101; i++){
			if(!arr.contains(X-i))
			{System.out.println(X-i);break;}
		else if(!arr.contains(X+i))
			{System.out.println(X+i);break;}
		}
		
	
	}
}
} import java.util.*; util.* java import java.math.*; math.* java public class Main {
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();
		
		List<Integer> arr = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            int d = sc.nextInt();
			arr.add(d);
            }
			
			if(!arr.contains(X))
			{System.out.println(X);}
		else{
		for(int i = 0; i < 101; i++){
			if(!arr.contains(X-i))
			{System.out.println(X-i);break;}
		else if(!arr.contains(X+i))
			{System.out.println(X+i);break;}
		}
		
	
	}
}
} Main public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();
		
		List<Integer> arr = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            int d = sc.nextInt();
			arr.add(d);
            }
			
			if(!arr.contains(X))
			{System.out.println(X);}
		else{
		for(int i = 0; i < 101; i++){
			if(!arr.contains(X-i))
			{System.out.println(X-i);break;}
		else if(!arr.contains(X+i))
			{System.out.println(X+i);break;}
		}
		
	
	}
} main {
		
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();
		
		List<Integer> arr = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            int d = sc.nextInt();
			arr.add(d);
            }
			
			if(!arr.contains(X))
			{System.out.println(X);}
		else{
		for(int i = 0; i < 101; i++){
			if(!arr.contains(X-i))
			{System.out.println(X-i);break;}
		else if(!arr.contains(X+i))
			{System.out.println(X+i);break;}
		}
		
	
	}
} 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 List<Integer> arr = new ArrayList<>(); arr new ArrayList<>() for (int i = 0; i < N; i++) {
            int d = sc.nextInt();
			arr.add(d);
            } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            int d = sc.nextInt();
			arr.add(d);
            } {
            int d = sc.nextInt();
			arr.add(d);
            } int d = sc.nextInt(); d sc.nextInt() sc.nextInt sc arr.add(d) arr.add arr d if(!arr.contains(X))
			{System.out.println(X);}
		else{
		for(int i = 0; i < 101; i++){
			if(!arr.contains(X-i))
			{System.out.println(X-i);break;}
		else if(!arr.contains(X+i))
			{System.out.println(X+i);break;}
		}
		
	
	} !arr.contains(X) arr.contains(X) arr.contains arr X {System.out.println(X);} System.out.println(X) System.out.println System.out System System.out X {
		for(int i = 0; i < 101; i++){
			if(!arr.contains(X-i))
			{System.out.println(X-i);break;}
		else if(!arr.contains(X+i))
			{System.out.println(X+i);break;}
		}
		
	
	} for(int i = 0; i < 101; i++){
			if(!arr.contains(X-i))
			{System.out.println(X-i);break;}
		else if(!arr.contains(X+i))
			{System.out.println(X+i);break;}
		} int i = 0; int i = 0; i 0 i < 101 i 101 i++ i++ i {
			if(!arr.contains(X-i))
			{System.out.println(X-i);break;}
		else if(!arr.contains(X+i))
			{System.out.println(X+i);break;}
		} {
			if(!arr.contains(X-i))
			{System.out.println(X-i);break;}
		else if(!arr.contains(X+i))
			{System.out.println(X+i);break;}
		} if(!arr.contains(X-i))
			{System.out.println(X-i);break;}
		else if(!arr.contains(X+i))
			{System.out.println(X+i);break;} !arr.contains(X-i) arr.contains(X-i) arr.contains arr X-i X i {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(!arr.contains(X+i))
			{System.out.println(X+i);break;} !arr.contains(X+i) arr.contains(X+i) arr.contains arr X+i X i {System.out.println(X+i);break;} System.out.println(X+i) System.out.println System.out System System.out X+i X i break; 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();
		
		List<Integer> arr = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            int d = sc.nextInt();
			arr.add(d);
            }
			
			if(!arr.contains(X))
			{System.out.println(X);}
		else{
		for(int i = 0; i < 101; i++){
			if(!arr.contains(X-i))
			{System.out.println(X-i);break;}
		else if(!arr.contains(X+i))
			{System.out.println(X+i);break;}
		}
		
	
	}
}
} public class Main {
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();
		
		List<Integer> arr = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            int d = sc.nextInt();
			arr.add(d);
            }
			
			if(!arr.contains(X))
			{System.out.println(X);}
		else{
		for(int i = 0; i < 101; i++){
			if(!arr.contains(X-i))
			{System.out.println(X-i);break;}
		else if(!arr.contains(X+i))
			{System.out.println(X+i);break;}
		}
		
	
	}
}
} Main
import java.util.*;
import java.math.*;
public class Main {
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();
		
		List<Integer> arr = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            int d = sc.nextInt();
			arr.add(d);
            }
			
			if(!arr.contains(X))
			{System.out.println(X);}
		else{
		for(int i = 0; i < 101; i++){
			if(!arr.contains(X-i))
			{System.out.println(X-i);break;}
		else if(!arr.contains(X+i))
			{System.out.println(X+i);break;}
		}
		
	
	}
}
}