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();
		Integer nList[]	= new Integer[N];
		for(int i = 0; i < N; i++) {
			nList[i]	= sc.nextInt();
		}
		int ans			= X;
		Boolean flag	= true;
		for (int i = 0; i <= X && flag; i++) {
			if(!(Arrays.asList(nList).contains(X-i))) {
				ans = X-i;
				flag = false;
			}
			else if(!(Arrays.asList(nList).contains(X+i))) {
				ans =X+i;
				flag = false;
			}
		}
		System.out.println(ans);
	}
} 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();
		Integer nList[]	= new Integer[N];
		for(int i = 0; i < N; i++) {
			nList[i]	= sc.nextInt();
		}
		int ans			= X;
		Boolean flag	= true;
		for (int i = 0; i <= X && flag; i++) {
			if(!(Arrays.asList(nList).contains(X-i))) {
				ans = X-i;
				flag = false;
			}
			else if(!(Arrays.asList(nList).contains(X+i))) {
				ans =X+i;
				flag = false;
			}
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X			= sc.nextInt();
		int N			= sc.nextInt();
		Integer nList[]	= new Integer[N];
		for(int i = 0; i < N; i++) {
			nList[i]	= sc.nextInt();
		}
		int ans			= X;
		Boolean flag	= true;
		for (int i = 0; i <= X && flag; i++) {
			if(!(Arrays.asList(nList).contains(X-i))) {
				ans = X-i;
				flag = false;
			}
			else if(!(Arrays.asList(nList).contains(X+i))) {
				ans =X+i;
				flag = false;
			}
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int X			= sc.nextInt();
		int N			= sc.nextInt();
		Integer nList[]	= new Integer[N];
		for(int i = 0; i < N; i++) {
			nList[i]	= sc.nextInt();
		}
		int ans			= X;
		Boolean flag	= true;
		for (int i = 0; i <= X && flag; i++) {
			if(!(Arrays.asList(nList).contains(X-i))) {
				ans = X-i;
				flag = false;
			}
			else if(!(Arrays.asList(nList).contains(X+i))) {
				ans =X+i;
				flag = false;
			}
		}
		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 int N			= sc.nextInt(); N sc.nextInt() sc.nextInt sc Integer nList[]	= new Integer[N]; nList new Integer[N] N for(int i = 0; i < N; i++) {
			nList[i]	= sc.nextInt();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			nList[i]	= sc.nextInt();
		} {
			nList[i]	= sc.nextInt();
		} nList[i]	= sc.nextInt() nList[i] nList i sc.nextInt() sc.nextInt sc int ans			= X; ans X Boolean flag	= true; flag true for (int i = 0; i <= X && flag; i++) {
			if(!(Arrays.asList(nList).contains(X-i))) {
				ans = X-i;
				flag = false;
			}
			else if(!(Arrays.asList(nList).contains(X+i))) {
				ans =X+i;
				flag = false;
			}
		} int i = 0; int i = 0; i 0 i <= X && flag i <= X i X flag i++ i++ i {
			if(!(Arrays.asList(nList).contains(X-i))) {
				ans = X-i;
				flag = false;
			}
			else if(!(Arrays.asList(nList).contains(X+i))) {
				ans =X+i;
				flag = false;
			}
		} {
			if(!(Arrays.asList(nList).contains(X-i))) {
				ans = X-i;
				flag = false;
			}
			else if(!(Arrays.asList(nList).contains(X+i))) {
				ans =X+i;
				flag = false;
			}
		} if(!(Arrays.asList(nList).contains(X-i))) {
				ans = X-i;
				flag = false;
			}
			else if(!(Arrays.asList(nList).contains(X+i))) {
				ans =X+i;
				flag = false;
			} !(Arrays.asList(nList).contains(X-i)) (Arrays.asList(nList).contains(X-i)) Arrays.asList(nList).contains Arrays.asList(nList) Arrays.asList Arrays nList X-i X i {
				ans = X-i;
				flag = false;
			} ans = X-i ans X-i X i flag = false flag false if(!(Arrays.asList(nList).contains(X+i))) {
				ans =X+i;
				flag = false;
			} !(Arrays.asList(nList).contains(X+i)) (Arrays.asList(nList).contains(X+i)) Arrays.asList(nList).contains Arrays.asList(nList) Arrays.asList Arrays nList X+i X i {
				ans =X+i;
				flag = false;
			} ans =X+i ans X+i X i flag = false flag false 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();
		int N			= sc.nextInt();
		Integer nList[]	= new Integer[N];
		for(int i = 0; i < N; i++) {
			nList[i]	= sc.nextInt();
		}
		int ans			= X;
		Boolean flag	= true;
		for (int i = 0; i <= X && flag; i++) {
			if(!(Arrays.asList(nList).contains(X-i))) {
				ans = X-i;
				flag = false;
			}
			else if(!(Arrays.asList(nList).contains(X+i))) {
				ans =X+i;
				flag = false;
			}
		}
		System.out.println(ans);
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X			= sc.nextInt();
		int N			= sc.nextInt();
		Integer nList[]	= new Integer[N];
		for(int i = 0; i < N; i++) {
			nList[i]	= sc.nextInt();
		}
		int ans			= X;
		Boolean flag	= true;
		for (int i = 0; i <= X && flag; i++) {
			if(!(Arrays.asList(nList).contains(X-i))) {
				ans = X-i;
				flag = false;
			}
			else if(!(Arrays.asList(nList).contains(X+i))) {
				ans =X+i;
				flag = false;
			}
		}
		System.out.println(ans);
	}
} 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();
		Integer nList[]	= new Integer[N];
		for(int i = 0; i < N; i++) {
			nList[i]	= sc.nextInt();
		}
		int ans			= X;
		Boolean flag	= true;
		for (int i = 0; i <= X && flag; i++) {
			if(!(Arrays.asList(nList).contains(X-i))) {
				ans = X-i;
				flag = false;
			}
			else if(!(Arrays.asList(nList).contains(X+i))) {
				ans =X+i;
				flag = false;
			}
		}
		System.out.println(ans);
	}
}