import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
// C - Forbidden List
class Main{
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();

		ArrayList<Integer> lstA;

		lstA = new ArrayList<Integer>();

		for (int i=0; i < N; i++) {
			int x = sc.nextInt();
			lstA.add(x);

//			if (x==X) {
//				System.out.println(x);
//				return;
//			}
		}

		Collections.sort(lstA);

		if (N==0 || !lstA.contains(X)) {
			System.out.println(X);
			return;
		}

		int idx=1;

		while (true) {

			int minus = X - idx;
			int plus = X + idx;

			if (lstA.contains(minus) && lstA.contains(plus)) {
				idx++;
				continue;
			}

			if (!lstA.contains(minus) && !lstA.contains(minus)) {
				System.out.println(minus);
				break;
			} else if (!lstA.contains(minus)) {
				System.out.println(minus);
				break;
			} else {
				System.out.println(plus);
				break;
			}
		}


	}
} import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.Scanner; Scanner java.util class Main{
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();

		ArrayList<Integer> lstA;

		lstA = new ArrayList<Integer>();

		for (int i=0; i < N; i++) {
			int x = sc.nextInt();
			lstA.add(x);

//			if (x==X) {
//				System.out.println(x);
//				return;
//			}
		}

		Collections.sort(lstA);

		if (N==0 || !lstA.contains(X)) {
			System.out.println(X);
			return;
		}

		int idx=1;

		while (true) {

			int minus = X - idx;
			int plus = X + idx;

			if (lstA.contains(minus) && lstA.contains(plus)) {
				idx++;
				continue;
			}

			if (!lstA.contains(minus) && !lstA.contains(minus)) {
				System.out.println(minus);
				break;
			} else if (!lstA.contains(minus)) {
				System.out.println(minus);
				break;
			} else {
				System.out.println(plus);
				break;
			}
		}


	}
} Main public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();

		ArrayList<Integer> lstA;

		lstA = new ArrayList<Integer>();

		for (int i=0; i < N; i++) {
			int x = sc.nextInt();
			lstA.add(x);

//			if (x==X) {
//				System.out.println(x);
//				return;
//			}
		}

		Collections.sort(lstA);

		if (N==0 || !lstA.contains(X)) {
			System.out.println(X);
			return;
		}

		int idx=1;

		while (true) {

			int minus = X - idx;
			int plus = X + idx;

			if (lstA.contains(minus) && lstA.contains(plus)) {
				idx++;
				continue;
			}

			if (!lstA.contains(minus) && !lstA.contains(minus)) {
				System.out.println(minus);
				break;
			} else if (!lstA.contains(minus)) {
				System.out.println(minus);
				break;
			} else {
				System.out.println(plus);
				break;
			}
		}


	} main {

		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();

		ArrayList<Integer> lstA;

		lstA = new ArrayList<Integer>();

		for (int i=0; i < N; i++) {
			int x = sc.nextInt();
			lstA.add(x);

//			if (x==X) {
//				System.out.println(x);
//				return;
//			}
		}

		Collections.sort(lstA);

		if (N==0 || !lstA.contains(X)) {
			System.out.println(X);
			return;
		}

		int idx=1;

		while (true) {

			int minus = X - idx;
			int plus = X + idx;

			if (lstA.contains(minus) && lstA.contains(plus)) {
				idx++;
				continue;
			}

			if (!lstA.contains(minus) && !lstA.contains(minus)) {
				System.out.println(minus);
				break;
			} else if (!lstA.contains(minus)) {
				System.out.println(minus);
				break;
			} else {
				System.out.println(plus);
				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 ArrayList<Integer> lstA; lstA lstA = new ArrayList<Integer>() lstA new ArrayList<Integer>() for (int i=0; i < N; i++) {
			int x = sc.nextInt();
			lstA.add(x);

//			if (x==X) {
//				System.out.println(x);
//				return;
//			}
		} int i=0; int i=0; i 0 i < N i N i++ i++ i {
			int x = sc.nextInt();
			lstA.add(x);

//			if (x==X) {
//				System.out.println(x);
//				return;
//			}
		} {
			int x = sc.nextInt();
			lstA.add(x);

//			if (x==X) {
//				System.out.println(x);
//				return;
//			}
		} int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc lstA.add(x) lstA.add lstA x Collections.sort(lstA) Collections.sort Collections lstA if (N==0 || !lstA.contains(X)) {
			System.out.println(X);
			return;
		} N==0 || !lstA.contains(X) N==0 N 0 !lstA.contains(X) lstA.contains(X) lstA.contains lstA X {
			System.out.println(X);
			return;
		} System.out.println(X) System.out.println System.out System System.out X return; int idx=1; idx 1 while (true) {

			int minus = X - idx;
			int plus = X + idx;

			if (lstA.contains(minus) && lstA.contains(plus)) {
				idx++;
				continue;
			}

			if (!lstA.contains(minus) && !lstA.contains(minus)) {
				System.out.println(minus);
				break;
			} else if (!lstA.contains(minus)) {
				System.out.println(minus);
				break;
			} else {
				System.out.println(plus);
				break;
			}
		} true {

			int minus = X - idx;
			int plus = X + idx;

			if (lstA.contains(minus) && lstA.contains(plus)) {
				idx++;
				continue;
			}

			if (!lstA.contains(minus) && !lstA.contains(minus)) {
				System.out.println(minus);
				break;
			} else if (!lstA.contains(minus)) {
				System.out.println(minus);
				break;
			} else {
				System.out.println(plus);
				break;
			}
		} int minus = X - idx; minus X - idx X idx int plus = X + idx; plus X + idx X idx if (lstA.contains(minus) && lstA.contains(plus)) {
				idx++;
				continue;
			} lstA.contains(minus) && lstA.contains(plus) lstA.contains(minus) lstA.contains lstA minus lstA.contains(plus) lstA.contains lstA plus {
				idx++;
				continue;
			} idx++ idx continue; if (!lstA.contains(minus) && !lstA.contains(minus)) {
				System.out.println(minus);
				break;
			} else if (!lstA.contains(minus)) {
				System.out.println(minus);
				break;
			} else {
				System.out.println(plus);
				break;
			} !lstA.contains(minus) && !lstA.contains(minus) !lstA.contains(minus) lstA.contains(minus) lstA.contains lstA minus !lstA.contains(minus) lstA.contains(minus) lstA.contains lstA minus {
				System.out.println(minus);
				break;
			} System.out.println(minus) System.out.println System.out System System.out minus break; if (!lstA.contains(minus)) {
				System.out.println(minus);
				break;
			} else {
				System.out.println(plus);
				break;
			} !lstA.contains(minus) lstA.contains(minus) lstA.contains lstA minus {
				System.out.println(minus);
				break;
			} System.out.println(minus) System.out.println System.out System System.out minus break; {
				System.out.println(plus);
				break;
			} System.out.println(plus) System.out.println System.out System System.out plus break; String[] args args
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
// C - Forbidden List
class Main{
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();

		ArrayList<Integer> lstA;

		lstA = new ArrayList<Integer>();

		for (int i=0; i < N; i++) {
			int x = sc.nextInt();
			lstA.add(x);

//			if (x==X) {
//				System.out.println(x);
//				return;
//			}
		}

		Collections.sort(lstA);

		if (N==0 || !lstA.contains(X)) {
			System.out.println(X);
			return;
		}

		int idx=1;

		while (true) {

			int minus = X - idx;
			int plus = X + idx;

			if (lstA.contains(minus) && lstA.contains(plus)) {
				idx++;
				continue;
			}

			if (!lstA.contains(minus) && !lstA.contains(minus)) {
				System.out.println(minus);
				break;
			} else if (!lstA.contains(minus)) {
				System.out.println(minus);
				break;
			} else {
				System.out.println(plus);
				break;
			}
		}


	}
}