import java.util.HashSet;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int integerX = sc.nextInt();  //元の整数
		int youso = sc.nextInt();  //整数列の要素数
		HashSet<Integer> list = new HashSet<Integer>();  //整数列を入れるリスト

		//配列を入力
		for(int i=0 ; i<youso ; i++) {
			list.add(sc.nextInt());
		}

		int i = integerX-1;
		int j = integerX+1;

		if(list.isEmpty() || list.contains(integerX) != true) {
			System.out.println(integerX);
			return;
		}

		for(;;) {
			if(list.contains(i)) {
				i--;
			}
			else{
				System.out.println(i);
				return;
			}

			if(list.contains(j)) {
				j++;
			}
			else {
				System.out.println(j);
				return;
			}
		}
	}
} import java.util.HashSet; HashSet 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 integerX = sc.nextInt();  //元の整数
		int youso = sc.nextInt();  //整数列の要素数
		HashSet<Integer> list = new HashSet<Integer>();  //整数列を入れるリスト

		//配列を入力
		for(int i=0 ; i<youso ; i++) {
			list.add(sc.nextInt());
		}

		int i = integerX-1;
		int j = integerX+1;

		if(list.isEmpty() || list.contains(integerX) != true) {
			System.out.println(integerX);
			return;
		}

		for(;;) {
			if(list.contains(i)) {
				i--;
			}
			else{
				System.out.println(i);
				return;
			}

			if(list.contains(j)) {
				j++;
			}
			else {
				System.out.println(j);
				return;
			}
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int integerX = sc.nextInt();  //元の整数
		int youso = sc.nextInt();  //整数列の要素数
		HashSet<Integer> list = new HashSet<Integer>();  //整数列を入れるリスト

		//配列を入力
		for(int i=0 ; i<youso ; i++) {
			list.add(sc.nextInt());
		}

		int i = integerX-1;
		int j = integerX+1;

		if(list.isEmpty() || list.contains(integerX) != true) {
			System.out.println(integerX);
			return;
		}

		for(;;) {
			if(list.contains(i)) {
				i--;
			}
			else{
				System.out.println(i);
				return;
			}

			if(list.contains(j)) {
				j++;
			}
			else {
				System.out.println(j);
				return;
			}
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int integerX = sc.nextInt();  //元の整数
		int youso = sc.nextInt();  //整数列の要素数
		HashSet<Integer> list = new HashSet<Integer>();  //整数列を入れるリスト

		//配列を入力
		for(int i=0 ; i<youso ; i++) {
			list.add(sc.nextInt());
		}

		int i = integerX-1;
		int j = integerX+1;

		if(list.isEmpty() || list.contains(integerX) != true) {
			System.out.println(integerX);
			return;
		}

		for(;;) {
			if(list.contains(i)) {
				i--;
			}
			else{
				System.out.println(i);
				return;
			}

			if(list.contains(j)) {
				j++;
			}
			else {
				System.out.println(j);
				return;
			}
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int integerX = sc.nextInt(); integerX sc.nextInt() sc.nextInt sc int youso = sc.nextInt(); youso sc.nextInt() sc.nextInt sc HashSet<Integer> list = new HashSet<Integer>(); list new HashSet<Integer>() for(int i=0 ; i<youso ; i++) {
			list.add(sc.nextInt());
		} int i=0 ; int i=0 ; i 0 i<youso i youso i++ i++ i {
			list.add(sc.nextInt());
		} {
			list.add(sc.nextInt());
		} list.add(sc.nextInt()) list.add list sc.nextInt() sc.nextInt sc int i = integerX-1; i integerX-1 integerX 1 int j = integerX+1; j integerX+1 integerX 1 if(list.isEmpty() || list.contains(integerX) != true) {
			System.out.println(integerX);
			return;
		} list.isEmpty() || list.contains(integerX) != true list.isEmpty() list.isEmpty list list.contains(integerX) != true list.contains(integerX) list.contains list integerX true {
			System.out.println(integerX);
			return;
		} System.out.println(integerX) System.out.println System.out System System.out integerX return; for(;;) {
			if(list.contains(i)) {
				i--;
			}
			else{
				System.out.println(i);
				return;
			}

			if(list.contains(j)) {
				j++;
			}
			else {
				System.out.println(j);
				return;
			}
		} ; {
			if(list.contains(i)) {
				i--;
			}
			else{
				System.out.println(i);
				return;
			}

			if(list.contains(j)) {
				j++;
			}
			else {
				System.out.println(j);
				return;
			}
		} {
			if(list.contains(i)) {
				i--;
			}
			else{
				System.out.println(i);
				return;
			}

			if(list.contains(j)) {
				j++;
			}
			else {
				System.out.println(j);
				return;
			}
		} if(list.contains(i)) {
				i--;
			}
			else{
				System.out.println(i);
				return;
			} list.contains(i) list.contains list i {
				i--;
			} i-- i {
				System.out.println(i);
				return;
			} System.out.println(i) System.out.println System.out System System.out i return; if(list.contains(j)) {
				j++;
			}
			else {
				System.out.println(j);
				return;
			} list.contains(j) list.contains list j {
				j++;
			} j++ j {
				System.out.println(j);
				return;
			} System.out.println(j) System.out.println System.out System System.out j return; String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int integerX = sc.nextInt();  //元の整数
		int youso = sc.nextInt();  //整数列の要素数
		HashSet<Integer> list = new HashSet<Integer>();  //整数列を入れるリスト

		//配列を入力
		for(int i=0 ; i<youso ; i++) {
			list.add(sc.nextInt());
		}

		int i = integerX-1;
		int j = integerX+1;

		if(list.isEmpty() || list.contains(integerX) != true) {
			System.out.println(integerX);
			return;
		}

		for(;;) {
			if(list.contains(i)) {
				i--;
			}
			else{
				System.out.println(i);
				return;
			}

			if(list.contains(j)) {
				j++;
			}
			else {
				System.out.println(j);
				return;
			}
		}
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int integerX = sc.nextInt();  //元の整数
		int youso = sc.nextInt();  //整数列の要素数
		HashSet<Integer> list = new HashSet<Integer>();  //整数列を入れるリスト

		//配列を入力
		for(int i=0 ; i<youso ; i++) {
			list.add(sc.nextInt());
		}

		int i = integerX-1;
		int j = integerX+1;

		if(list.isEmpty() || list.contains(integerX) != true) {
			System.out.println(integerX);
			return;
		}

		for(;;) {
			if(list.contains(i)) {
				i--;
			}
			else{
				System.out.println(i);
				return;
			}

			if(list.contains(j)) {
				j++;
			}
			else {
				System.out.println(j);
				return;
			}
		}
	}
} Main
import java.util.HashSet;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int integerX = sc.nextInt();  //元の整数
		int youso = sc.nextInt();  //整数列の要素数
		HashSet<Integer> list = new HashSet<Integer>();  //整数列を入れるリスト

		//配列を入力
		for(int i=0 ; i<youso ; i++) {
			list.add(sc.nextInt());
		}

		int i = integerX-1;
		int j = integerX+1;

		if(list.isEmpty() || list.contains(integerX) != true) {
			System.out.println(integerX);
			return;
		}

		for(;;) {
			if(list.contains(i)) {
				i--;
			}
			else{
				System.out.println(i);
				return;
			}

			if(list.contains(j)) {
				j++;
			}
			else {
				System.out.println(j);
				return;
			}
		}
	}
}