import java.util.Arrays;
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];
		for(int i=0; i<n;i++) {
			p[i] = sc.nextInt();
		}

		Arrays.sort(p);
		
//		for(int i=0; i<n;i++) {
//			System.out.println(p[i]);
//		}

		boolean flg = true;
		for(int i=0; i<n;i++) {
			if(x == p[i]) {
				flg = false;
				break;
			}
		}
		if(flg == true) {
			System.out.println(x);
			System.exit(0);;
		}

		int xx =0;
		for(int i=1; i<100; i++) {
			xx = x - i;
			flg = true;
			for(int j=0; j<n;j++) {
				if(xx == p[j]) {
					flg = false;
					break;
				}
			}
			if(flg == true) {
				System.out.println(xx);
				System.exit(0);;
			}
			
			xx = x + i;
			flg = true;
			for(int j=0; j<n;j++) {
				if(xx == p[j]) {
					flg = false;
					break;
				}
			}
			if(flg == true) {
				System.out.println(xx);
				System.exit(0);;
			}
			
		}

	}
	
} import java.util.Arrays; Arrays 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();
		int n = sc.nextInt();
		
		int p[] = new int[n];
		for(int i=0; i<n;i++) {
			p[i] = sc.nextInt();
		}

		Arrays.sort(p);
		
//		for(int i=0; i<n;i++) {
//			System.out.println(p[i]);
//		}

		boolean flg = true;
		for(int i=0; i<n;i++) {
			if(x == p[i]) {
				flg = false;
				break;
			}
		}
		if(flg == true) {
			System.out.println(x);
			System.exit(0);;
		}

		int xx =0;
		for(int i=1; i<100; i++) {
			xx = x - i;
			flg = true;
			for(int j=0; j<n;j++) {
				if(xx == p[j]) {
					flg = false;
					break;
				}
			}
			if(flg == true) {
				System.out.println(xx);
				System.exit(0);;
			}
			
			xx = x + i;
			flg = true;
			for(int j=0; j<n;j++) {
				if(xx == p[j]) {
					flg = false;
					break;
				}
			}
			if(flg == true) {
				System.out.println(xx);
				System.exit(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];
		for(int i=0; i<n;i++) {
			p[i] = sc.nextInt();
		}

		Arrays.sort(p);
		
//		for(int i=0; i<n;i++) {
//			System.out.println(p[i]);
//		}

		boolean flg = true;
		for(int i=0; i<n;i++) {
			if(x == p[i]) {
				flg = false;
				break;
			}
		}
		if(flg == true) {
			System.out.println(x);
			System.exit(0);;
		}

		int xx =0;
		for(int i=1; i<100; i++) {
			xx = x - i;
			flg = true;
			for(int j=0; j<n;j++) {
				if(xx == p[j]) {
					flg = false;
					break;
				}
			}
			if(flg == true) {
				System.out.println(xx);
				System.exit(0);;
			}
			
			xx = x + i;
			flg = true;
			for(int j=0; j<n;j++) {
				if(xx == p[j]) {
					flg = false;
					break;
				}
			}
			if(flg == true) {
				System.out.println(xx);
				System.exit(0);;
			}
			
		}

	} main {
		
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		
		int p[] = new int[n];
		for(int i=0; i<n;i++) {
			p[i] = sc.nextInt();
		}

		Arrays.sort(p);
		
//		for(int i=0; i<n;i++) {
//			System.out.println(p[i]);
//		}

		boolean flg = true;
		for(int i=0; i<n;i++) {
			if(x == p[i]) {
				flg = false;
				break;
			}
		}
		if(flg == true) {
			System.out.println(x);
			System.exit(0);;
		}

		int xx =0;
		for(int i=1; i<100; i++) {
			xx = x - i;
			flg = true;
			for(int j=0; j<n;j++) {
				if(xx == p[j]) {
					flg = false;
					break;
				}
			}
			if(flg == true) {
				System.out.println(xx);
				System.exit(0);;
			}
			
			xx = x + i;
			flg = true;
			for(int j=0; j<n;j++) {
				if(xx == p[j]) {
					flg = false;
					break;
				}
			}
			if(flg == true) {
				System.out.println(xx);
				System.exit(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 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 Arrays.sort(p) Arrays.sort Arrays p boolean flg = true; flg true for(int i=0; i<n;i++) {
			if(x == p[i]) {
				flg = false;
				break;
			}
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			if(x == p[i]) {
				flg = false;
				break;
			}
		} {
			if(x == p[i]) {
				flg = false;
				break;
			}
		} if(x == p[i]) {
				flg = false;
				break;
			} x == p[i] x p[i] p i {
				flg = false;
				break;
			} flg = false flg false break; if(flg == true) {
			System.out.println(x);
			System.exit(0);;
		} flg == true flg true {
			System.out.println(x);
			System.exit(0);;
		} System.out.println(x) System.out.println System.out System System.out x System.exit(0) System.exit System 0 int xx =0; xx 0 for(int i=1; i<100; i++) {
			xx = x - i;
			flg = true;
			for(int j=0; j<n;j++) {
				if(xx == p[j]) {
					flg = false;
					break;
				}
			}
			if(flg == true) {
				System.out.println(xx);
				System.exit(0);;
			}
			
			xx = x + i;
			flg = true;
			for(int j=0; j<n;j++) {
				if(xx == p[j]) {
					flg = false;
					break;
				}
			}
			if(flg == true) {
				System.out.println(xx);
				System.exit(0);;
			}
			
		} int i=1; int i=1; i 1 i<100 i 100 i++ i++ i {
			xx = x - i;
			flg = true;
			for(int j=0; j<n;j++) {
				if(xx == p[j]) {
					flg = false;
					break;
				}
			}
			if(flg == true) {
				System.out.println(xx);
				System.exit(0);;
			}
			
			xx = x + i;
			flg = true;
			for(int j=0; j<n;j++) {
				if(xx == p[j]) {
					flg = false;
					break;
				}
			}
			if(flg == true) {
				System.out.println(xx);
				System.exit(0);;
			}
			
		} {
			xx = x - i;
			flg = true;
			for(int j=0; j<n;j++) {
				if(xx == p[j]) {
					flg = false;
					break;
				}
			}
			if(flg == true) {
				System.out.println(xx);
				System.exit(0);;
			}
			
			xx = x + i;
			flg = true;
			for(int j=0; j<n;j++) {
				if(xx == p[j]) {
					flg = false;
					break;
				}
			}
			if(flg == true) {
				System.out.println(xx);
				System.exit(0);;
			}
			
		} xx = x - i xx x - i x i flg = true flg true for(int j=0; j<n;j++) {
				if(xx == p[j]) {
					flg = false;
					break;
				}
			} int j=0; int j=0; j 0 j<n j n j++ j++ j {
				if(xx == p[j]) {
					flg = false;
					break;
				}
			} {
				if(xx == p[j]) {
					flg = false;
					break;
				}
			} if(xx == p[j]) {
					flg = false;
					break;
				} xx == p[j] xx p[j] p j {
					flg = false;
					break;
				} flg = false flg false break; if(flg == true) {
				System.out.println(xx);
				System.exit(0);;
			} flg == true flg true {
				System.out.println(xx);
				System.exit(0);;
			} System.out.println(xx) System.out.println System.out System System.out xx System.exit(0) System.exit System 0 xx = x + i xx x + i x i flg = true flg true for(int j=0; j<n;j++) {
				if(xx == p[j]) {
					flg = false;
					break;
				}
			} int j=0; int j=0; j 0 j<n j n j++ j++ j {
				if(xx == p[j]) {
					flg = false;
					break;
				}
			} {
				if(xx == p[j]) {
					flg = false;
					break;
				}
			} if(xx == p[j]) {
					flg = false;
					break;
				} xx == p[j] xx p[j] p j {
					flg = false;
					break;
				} flg = false flg false break; if(flg == true) {
				System.out.println(xx);
				System.exit(0);;
			} flg == true flg true {
				System.out.println(xx);
				System.exit(0);;
			} System.out.println(xx) System.out.println System.out System System.out xx System.exit(0) System.exit System 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];
		for(int i=0; i<n;i++) {
			p[i] = sc.nextInt();
		}

		Arrays.sort(p);
		
//		for(int i=0; i<n;i++) {
//			System.out.println(p[i]);
//		}

		boolean flg = true;
		for(int i=0; i<n;i++) {
			if(x == p[i]) {
				flg = false;
				break;
			}
		}
		if(flg == true) {
			System.out.println(x);
			System.exit(0);;
		}

		int xx =0;
		for(int i=1; i<100; i++) {
			xx = x - i;
			flg = true;
			for(int j=0; j<n;j++) {
				if(xx == p[j]) {
					flg = false;
					break;
				}
			}
			if(flg == true) {
				System.out.println(xx);
				System.exit(0);;
			}
			
			xx = x + i;
			flg = true;
			for(int j=0; j<n;j++) {
				if(xx == p[j]) {
					flg = false;
					break;
				}
			}
			if(flg == true) {
				System.out.println(xx);
				System.exit(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];
		for(int i=0; i<n;i++) {
			p[i] = sc.nextInt();
		}

		Arrays.sort(p);
		
//		for(int i=0; i<n;i++) {
//			System.out.println(p[i]);
//		}

		boolean flg = true;
		for(int i=0; i<n;i++) {
			if(x == p[i]) {
				flg = false;
				break;
			}
		}
		if(flg == true) {
			System.out.println(x);
			System.exit(0);;
		}

		int xx =0;
		for(int i=1; i<100; i++) {
			xx = x - i;
			flg = true;
			for(int j=0; j<n;j++) {
				if(xx == p[j]) {
					flg = false;
					break;
				}
			}
			if(flg == true) {
				System.out.println(xx);
				System.exit(0);;
			}
			
			xx = x + i;
			flg = true;
			for(int j=0; j<n;j++) {
				if(xx == p[j]) {
					flg = false;
					break;
				}
			}
			if(flg == true) {
				System.out.println(xx);
				System.exit(0);;
			}
			
		}

	}
	
} Main
import java.util.Arrays;
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];
		for(int i=0; i<n;i++) {
			p[i] = sc.nextInt();
		}

		Arrays.sort(p);
		
//		for(int i=0; i<n;i++) {
//			System.out.println(p[i]);
//		}

		boolean flg = true;
		for(int i=0; i<n;i++) {
			if(x == p[i]) {
				flg = false;
				break;
			}
		}
		if(flg == true) {
			System.out.println(x);
			System.exit(0);;
		}

		int xx =0;
		for(int i=1; i<100; i++) {
			xx = x - i;
			flg = true;
			for(int j=0; j<n;j++) {
				if(xx == p[j]) {
					flg = false;
					break;
				}
			}
			if(flg == true) {
				System.out.println(xx);
				System.exit(0);;
			}
			
			xx = x + i;
			flg = true;
			for(int j=0; j<n;j++) {
				if(xx == p[j]) {
					flg = false;
					break;
				}
			}
			if(flg == true) {
				System.out.println(xx);
				System.exit(0);;
			}
			
		}

	}
	
}
