import java.util.ArrayList;
import java.util.List;
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();
		List<Integer> list = new ArrayList<>();
		int ans = x;

		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}

		for (int dif = 0; dif <= n; dif++) {

			//x-difがリストに無いとき
			if (!list.contains(x - dif)) {
				ans = x - dif;
				break;
			}

			//x+difがリストに無いとき
			if (!list.contains(x + dif)) {
				ans = x + dif;
				break;
			}

		}

		System.out.println(ans);

	}

} import java.util.ArrayList; ArrayList java.util import java.util.List; List 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();
		List<Integer> list = new ArrayList<>();
		int ans = x;

		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}

		for (int dif = 0; dif <= n; dif++) {

			//x-difがリストに無いとき
			if (!list.contains(x - dif)) {
				ans = x - dif;
				break;
			}

			//x+difがリストに無いとき
			if (!list.contains(x + dif)) {
				ans = x + dif;
				break;
			}

		}

		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();
		List<Integer> list = new ArrayList<>();
		int ans = x;

		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}

		for (int dif = 0; dif <= n; dif++) {

			//x-difがリストに無いとき
			if (!list.contains(x - dif)) {
				ans = x - dif;
				break;
			}

			//x+difがリストに無いとき
			if (!list.contains(x + dif)) {
				ans = x + dif;
				break;
			}

		}

		System.out.println(ans);

	} main {

		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();
		int n = sc.nextInt();
		List<Integer> list = new ArrayList<>();
		int ans = x;

		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}

		for (int dif = 0; dif <= n; dif++) {

			//x-difがリストに無いとき
			if (!list.contains(x - dif)) {
				ans = x - dif;
				break;
			}

			//x+difがリストに無いとき
			if (!list.contains(x + dif)) {
				ans = x + dif;
				break;
			}

		}

		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 List<Integer> list = new ArrayList<>(); list new ArrayList<>() int ans = x; ans x for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			list.add(sc.nextInt());
		} {
			list.add(sc.nextInt());
		} list.add(sc.nextInt()) list.add list sc.nextInt() sc.nextInt sc for (int dif = 0; dif <= n; dif++) {

			//x-difがリストに無いとき
			if (!list.contains(x - dif)) {
				ans = x - dif;
				break;
			}

			//x+difがリストに無いとき
			if (!list.contains(x + dif)) {
				ans = x + dif;
				break;
			}

		} int dif = 0; int dif = 0; dif 0 dif <= n dif n dif++ dif++ dif {

			//x-difがリストに無いとき
			if (!list.contains(x - dif)) {
				ans = x - dif;
				break;
			}

			//x+difがリストに無いとき
			if (!list.contains(x + dif)) {
				ans = x + dif;
				break;
			}

		} {

			//x-difがリストに無いとき
			if (!list.contains(x - dif)) {
				ans = x - dif;
				break;
			}

			//x+difがリストに無いとき
			if (!list.contains(x + dif)) {
				ans = x + dif;
				break;
			}

		} if (!list.contains(x - dif)) {
				ans = x - dif;
				break;
			} !list.contains(x - dif) list.contains(x - dif) list.contains list x - dif x dif {
				ans = x - dif;
				break;
			} ans = x - dif ans x - dif x dif break; if (!list.contains(x + dif)) {
				ans = x + dif;
				break;
			} !list.contains(x + dif) list.contains(x + dif) list.contains list x + dif x dif {
				ans = x + dif;
				break;
			} ans = x + dif ans x + dif x dif break; 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();
		List<Integer> list = new ArrayList<>();
		int ans = x;

		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}

		for (int dif = 0; dif <= n; dif++) {

			//x-difがリストに無いとき
			if (!list.contains(x - dif)) {
				ans = x - dif;
				break;
			}

			//x+difがリストに無いとき
			if (!list.contains(x + dif)) {
				ans = x + dif;
				break;
			}

		}

		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();
		List<Integer> list = new ArrayList<>();
		int ans = x;

		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}

		for (int dif = 0; dif <= n; dif++) {

			//x-difがリストに無いとき
			if (!list.contains(x - dif)) {
				ans = x - dif;
				break;
			}

			//x+difがリストに無いとき
			if (!list.contains(x + dif)) {
				ans = x + dif;
				break;
			}

		}

		System.out.println(ans);

	}

} Main
import java.util.ArrayList;
import java.util.List;
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();
		List<Integer> list = new ArrayList<>();
		int ans = x;

		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}

		for (int dif = 0; dif <= n; dif++) {

			//x-difがリストに無いとき
			if (!list.contains(x - dif)) {
				ans = x - dif;
				break;
			}

			//x+difがリストに無いとき
			if (!list.contains(x + dif)) {
				ans = x + dif;
				break;
			}

		}

		System.out.println(ans);

	}

}
