import java.util.*;

public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		int X  = keyboard.nextInt();
		int N  = keyboard.nextInt();
		
		int p;
		final int nmax = 102;
		int[] hako  = new int[nmax];
		
		int ans = 0;
		
		for(int i=0; i<N; i++) {
			p = keyboard.nextInt();
			hako[p] = 1;
		}
		
		for(int j=0; j<nmax; j++) {
			if(X-j >=0 && hako[X-j] == 0){
				ans = X-j;
				break;
			} 
			else {
				if(X+j <nmax && hako[X+j] == 0){
					ans = X+j;
					break;
				}
			}
		}
		
		System.out.print(ans);
		keyboard.close();	
	}
} import java.util.*; util.* java public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		int X  = keyboard.nextInt();
		int N  = keyboard.nextInt();
		
		int p;
		final int nmax = 102;
		int[] hako  = new int[nmax];
		
		int ans = 0;
		
		for(int i=0; i<N; i++) {
			p = keyboard.nextInt();
			hako[p] = 1;
		}
		
		for(int j=0; j<nmax; j++) {
			if(X-j >=0 && hako[X-j] == 0){
				ans = X-j;
				break;
			} 
			else {
				if(X+j <nmax && hako[X+j] == 0){
					ans = X+j;
					break;
				}
			}
		}
		
		System.out.print(ans);
		keyboard.close();	
	}
} Main public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		int X  = keyboard.nextInt();
		int N  = keyboard.nextInt();
		
		int p;
		final int nmax = 102;
		int[] hako  = new int[nmax];
		
		int ans = 0;
		
		for(int i=0; i<N; i++) {
			p = keyboard.nextInt();
			hako[p] = 1;
		}
		
		for(int j=0; j<nmax; j++) {
			if(X-j >=0 && hako[X-j] == 0){
				ans = X-j;
				break;
			} 
			else {
				if(X+j <nmax && hako[X+j] == 0){
					ans = X+j;
					break;
				}
			}
		}
		
		System.out.print(ans);
		keyboard.close();	
	} main {
		
		Scanner keyboard = new Scanner(System.in); 
		
		int X  = keyboard.nextInt();
		int N  = keyboard.nextInt();
		
		int p;
		final int nmax = 102;
		int[] hako  = new int[nmax];
		
		int ans = 0;
		
		for(int i=0; i<N; i++) {
			p = keyboard.nextInt();
			hako[p] = 1;
		}
		
		for(int j=0; j<nmax; j++) {
			if(X-j >=0 && hako[X-j] == 0){
				ans = X-j;
				break;
			} 
			else {
				if(X+j <nmax && hako[X+j] == 0){
					ans = X+j;
					break;
				}
			}
		}
		
		System.out.print(ans);
		keyboard.close();	
	} Scanner keyboard = new Scanner(System.in); keyboard new Scanner(System.in) int X  = keyboard.nextInt(); X keyboard.nextInt() keyboard.nextInt keyboard int N  = keyboard.nextInt(); N keyboard.nextInt() keyboard.nextInt keyboard int p; p final int nmax = 102; nmax 102 int[] hako  = new int[nmax]; hako new int[nmax] nmax int ans = 0; ans 0 for(int i=0; i<N; i++) {
			p = keyboard.nextInt();
			hako[p] = 1;
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			p = keyboard.nextInt();
			hako[p] = 1;
		} {
			p = keyboard.nextInt();
			hako[p] = 1;
		} p = keyboard.nextInt() p keyboard.nextInt() keyboard.nextInt keyboard hako[p] = 1 hako[p] hako p 1 for(int j=0; j<nmax; j++) {
			if(X-j >=0 && hako[X-j] == 0){
				ans = X-j;
				break;
			} 
			else {
				if(X+j <nmax && hako[X+j] == 0){
					ans = X+j;
					break;
				}
			}
		} int j=0; int j=0; j 0 j<nmax j nmax j++ j++ j {
			if(X-j >=0 && hako[X-j] == 0){
				ans = X-j;
				break;
			} 
			else {
				if(X+j <nmax && hako[X+j] == 0){
					ans = X+j;
					break;
				}
			}
		} {
			if(X-j >=0 && hako[X-j] == 0){
				ans = X-j;
				break;
			} 
			else {
				if(X+j <nmax && hako[X+j] == 0){
					ans = X+j;
					break;
				}
			}
		} if(X-j >=0 && hako[X-j] == 0){
				ans = X-j;
				break;
			} 
			else {
				if(X+j <nmax && hako[X+j] == 0){
					ans = X+j;
					break;
				}
			} X-j >=0 && hako[X-j] == 0 X-j >=0 X-j X j 0 hako[X-j] == 0 hako[X-j] hako X-j X j 0 {
				ans = X-j;
				break;
			} ans = X-j ans X-j X j break; {
				if(X+j <nmax && hako[X+j] == 0){
					ans = X+j;
					break;
				}
			} if(X+j <nmax && hako[X+j] == 0){
					ans = X+j;
					break;
				} X+j <nmax && hako[X+j] == 0 X+j <nmax X+j X j nmax hako[X+j] == 0 hako[X+j] hako X+j X j 0 {
					ans = X+j;
					break;
				} ans = X+j ans X+j X j break; System.out.print(ans) System.out.print System.out System System.out ans keyboard.close() keyboard.close keyboard String[] args args public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		int X  = keyboard.nextInt();
		int N  = keyboard.nextInt();
		
		int p;
		final int nmax = 102;
		int[] hako  = new int[nmax];
		
		int ans = 0;
		
		for(int i=0; i<N; i++) {
			p = keyboard.nextInt();
			hako[p] = 1;
		}
		
		for(int j=0; j<nmax; j++) {
			if(X-j >=0 && hako[X-j] == 0){
				ans = X-j;
				break;
			} 
			else {
				if(X+j <nmax && hako[X+j] == 0){
					ans = X+j;
					break;
				}
			}
		}
		
		System.out.print(ans);
		keyboard.close();	
	}
} public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		int X  = keyboard.nextInt();
		int N  = keyboard.nextInt();
		
		int p;
		final int nmax = 102;
		int[] hako  = new int[nmax];
		
		int ans = 0;
		
		for(int i=0; i<N; i++) {
			p = keyboard.nextInt();
			hako[p] = 1;
		}
		
		for(int j=0; j<nmax; j++) {
			if(X-j >=0 && hako[X-j] == 0){
				ans = X-j;
				break;
			} 
			else {
				if(X+j <nmax && hako[X+j] == 0){
					ans = X+j;
					break;
				}
			}
		}
		
		System.out.print(ans);
		keyboard.close();	
	}
} Main
import java.util.*;

public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		int X  = keyboard.nextInt();
		int N  = keyboard.nextInt();
		
		int p;
		final int nmax = 102;
		int[] hako  = new int[nmax];
		
		int ans = 0;
		
		for(int i=0; i<N; i++) {
			p = keyboard.nextInt();
			hako[p] = 1;
		}
		
		for(int j=0; j<nmax; j++) {
			if(X-j >=0 && hako[X-j] == 0){
				ans = X-j;
				break;
			} 
			else {
				if(X+j <nmax && hako[X+j] == 0){
					ans = X+j;
					break;
				}
			}
		}
		
		System.out.print(ans);
		keyboard.close();	
	}
}
