

import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		
		int x,y,n,j;
		x = scan.nextInt();
		n = scan.nextInt();
		
		int[] ary = new int[n];
		
		for(int i=0;i<n;i++) {
			ary[i] = scan.nextInt();
		}
		
		Arrays.sort(ary);
		j = 0;
		
		while(true) {
			if(Arrays.binarySearch(ary, x-j) < 0) {
				y = x-j;
				break;
			}else if(Arrays.binarySearch(ary, x+j) < 0) {
				y = x+j;
				break;
			}else {
				j++;
				continue;
			}
		}
		System.out.println(y);
	}

} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		
		int x,y,n,j;
		x = scan.nextInt();
		n = scan.nextInt();
		
		int[] ary = new int[n];
		
		for(int i=0;i<n;i++) {
			ary[i] = scan.nextInt();
		}
		
		Arrays.sort(ary);
		j = 0;
		
		while(true) {
			if(Arrays.binarySearch(ary, x-j) < 0) {
				y = x-j;
				break;
			}else if(Arrays.binarySearch(ary, x+j) < 0) {
				y = x+j;
				break;
			}else {
				j++;
				continue;
			}
		}
		System.out.println(y);
	}

} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		
		int x,y,n,j;
		x = scan.nextInt();
		n = scan.nextInt();
		
		int[] ary = new int[n];
		
		for(int i=0;i<n;i++) {
			ary[i] = scan.nextInt();
		}
		
		Arrays.sort(ary);
		j = 0;
		
		while(true) {
			if(Arrays.binarySearch(ary, x-j) < 0) {
				y = x-j;
				break;
			}else if(Arrays.binarySearch(ary, x+j) < 0) {
				y = x+j;
				break;
			}else {
				j++;
				continue;
			}
		}
		System.out.println(y);
	} main {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		
		int x,y,n,j;
		x = scan.nextInt();
		n = scan.nextInt();
		
		int[] ary = new int[n];
		
		for(int i=0;i<n;i++) {
			ary[i] = scan.nextInt();
		}
		
		Arrays.sort(ary);
		j = 0;
		
		while(true) {
			if(Arrays.binarySearch(ary, x-j) < 0) {
				y = x-j;
				break;
			}else if(Arrays.binarySearch(ary, x+j) < 0) {
				y = x+j;
				break;
			}else {
				j++;
				continue;
			}
		}
		System.out.println(y);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int x x y y n n j; j x = scan.nextInt() x scan.nextInt() scan.nextInt scan n = scan.nextInt() n scan.nextInt() scan.nextInt scan int[] ary = new int[n]; ary new int[n] n for(int i=0;i<n;i++) {
			ary[i] = scan.nextInt();
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			ary[i] = scan.nextInt();
		} {
			ary[i] = scan.nextInt();
		} ary[i] = scan.nextInt() ary[i] ary i scan.nextInt() scan.nextInt scan Arrays.sort(ary) Arrays.sort Arrays ary j = 0 j 0 while(true) {
			if(Arrays.binarySearch(ary, x-j) < 0) {
				y = x-j;
				break;
			}else if(Arrays.binarySearch(ary, x+j) < 0) {
				y = x+j;
				break;
			}else {
				j++;
				continue;
			}
		} true {
			if(Arrays.binarySearch(ary, x-j) < 0) {
				y = x-j;
				break;
			}else if(Arrays.binarySearch(ary, x+j) < 0) {
				y = x+j;
				break;
			}else {
				j++;
				continue;
			}
		} if(Arrays.binarySearch(ary, x-j) < 0) {
				y = x-j;
				break;
			}else if(Arrays.binarySearch(ary, x+j) < 0) {
				y = x+j;
				break;
			}else {
				j++;
				continue;
			} Arrays.binarySearch(ary, x-j) < 0 Arrays.binarySearch(ary, x-j) Arrays.binarySearch Arrays ary x-j x j 0 {
				y = x-j;
				break;
			} y = x-j y x-j x j break; if(Arrays.binarySearch(ary, x+j) < 0) {
				y = x+j;
				break;
			}else {
				j++;
				continue;
			} Arrays.binarySearch(ary, x+j) < 0 Arrays.binarySearch(ary, x+j) Arrays.binarySearch Arrays ary x+j x j 0 {
				y = x+j;
				break;
			} y = x+j y x+j x j break; {
				j++;
				continue;
			} j++ j continue; System.out.println(y) System.out.println System.out System System.out y String[] args args public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		
		int x,y,n,j;
		x = scan.nextInt();
		n = scan.nextInt();
		
		int[] ary = new int[n];
		
		for(int i=0;i<n;i++) {
			ary[i] = scan.nextInt();
		}
		
		Arrays.sort(ary);
		j = 0;
		
		while(true) {
			if(Arrays.binarySearch(ary, x-j) < 0) {
				y = x-j;
				break;
			}else if(Arrays.binarySearch(ary, x+j) < 0) {
				y = x+j;
				break;
			}else {
				j++;
				continue;
			}
		}
		System.out.println(y);
	}

} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		
		int x,y,n,j;
		x = scan.nextInt();
		n = scan.nextInt();
		
		int[] ary = new int[n];
		
		for(int i=0;i<n;i++) {
			ary[i] = scan.nextInt();
		}
		
		Arrays.sort(ary);
		j = 0;
		
		while(true) {
			if(Arrays.binarySearch(ary, x-j) < 0) {
				y = x-j;
				break;
			}else if(Arrays.binarySearch(ary, x+j) < 0) {
				y = x+j;
				break;
			}else {
				j++;
				continue;
			}
		}
		System.out.println(y);
	}

} Main


import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		
		int x,y,n,j;
		x = scan.nextInt();
		n = scan.nextInt();
		
		int[] ary = new int[n];
		
		for(int i=0;i<n;i++) {
			ary[i] = scan.nextInt();
		}
		
		Arrays.sort(ary);
		j = 0;
		
		while(true) {
			if(Arrays.binarySearch(ary, x-j) < 0) {
				y = x-j;
				break;
			}else if(Arrays.binarySearch(ary, x+j) < 0) {
				y = x+j;
				break;
			}else {
				j++;
				continue;
			}
		}
		System.out.println(y);
	}

}
