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();
		if (n == 0) {
			System.out.println(x);
			System.exit(0);
		}
		List<Integer> list = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		boolean bool = true;
		int i = 0;
		while (bool) {
			if (!list.contains(x - i)) {
				bool = false;
				System.out.println(x - i);
				break;
			}
			if (!list.contains(x + i)) {
				bool = false;
				System.out.println(x + i);
				break;
			}
			i++;
		}
	}
} 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();
		if (n == 0) {
			System.out.println(x);
			System.exit(0);
		}
		List<Integer> list = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		boolean bool = true;
		int i = 0;
		while (bool) {
			if (!list.contains(x - i)) {
				bool = false;
				System.out.println(x - i);
				break;
			}
			if (!list.contains(x + i)) {
				bool = false;
				System.out.println(x + i);
				break;
			}
			i++;
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		if (n == 0) {
			System.out.println(x);
			System.exit(0);
		}
		List<Integer> list = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		boolean bool = true;
		int i = 0;
		while (bool) {
			if (!list.contains(x - i)) {
				bool = false;
				System.out.println(x - i);
				break;
			}
			if (!list.contains(x + i)) {
				bool = false;
				System.out.println(x + i);
				break;
			}
			i++;
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		if (n == 0) {
			System.out.println(x);
			System.exit(0);
		}
		List<Integer> list = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		boolean bool = true;
		int i = 0;
		while (bool) {
			if (!list.contains(x - i)) {
				bool = false;
				System.out.println(x - i);
				break;
			}
			if (!list.contains(x + i)) {
				bool = false;
				System.out.println(x + i);
				break;
			}
			i++;
		}
	} 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 if (n == 0) {
			System.out.println(x);
			System.exit(0);
		} n == 0 n 0 {
			System.out.println(x);
			System.exit(0);
		} System.out.println(x) System.out.println System.out System System.out x System.exit(0) System.exit System 0 List<Integer> list = new ArrayList<>(); list new ArrayList<>() 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 boolean bool = true; bool true int i = 0; i 0 while (bool) {
			if (!list.contains(x - i)) {
				bool = false;
				System.out.println(x - i);
				break;
			}
			if (!list.contains(x + i)) {
				bool = false;
				System.out.println(x + i);
				break;
			}
			i++;
		} bool {
			if (!list.contains(x - i)) {
				bool = false;
				System.out.println(x - i);
				break;
			}
			if (!list.contains(x + i)) {
				bool = false;
				System.out.println(x + i);
				break;
			}
			i++;
		} if (!list.contains(x - i)) {
				bool = false;
				System.out.println(x - i);
				break;
			} !list.contains(x - i) list.contains(x - i) list.contains list x - i x i {
				bool = false;
				System.out.println(x - i);
				break;
			} bool = false bool false System.out.println(x - i) System.out.println System.out System System.out x - i x i break; if (!list.contains(x + i)) {
				bool = false;
				System.out.println(x + i);
				break;
			} !list.contains(x + i) list.contains(x + i) list.contains list x + i x i {
				bool = false;
				System.out.println(x + i);
				break;
			} bool = false bool false System.out.println(x + i) System.out.println System.out System System.out x + i x i break; i++ i 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();
		if (n == 0) {
			System.out.println(x);
			System.exit(0);
		}
		List<Integer> list = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		boolean bool = true;
		int i = 0;
		while (bool) {
			if (!list.contains(x - i)) {
				bool = false;
				System.out.println(x - i);
				break;
			}
			if (!list.contains(x + i)) {
				bool = false;
				System.out.println(x + i);
				break;
			}
			i++;
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		if (n == 0) {
			System.out.println(x);
			System.exit(0);
		}
		List<Integer> list = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		boolean bool = true;
		int i = 0;
		while (bool) {
			if (!list.contains(x - i)) {
				bool = false;
				System.out.println(x - i);
				break;
			}
			if (!list.contains(x + i)) {
				bool = false;
				System.out.println(x + i);
				break;
			}
			i++;
		}
	}
} 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();
		if (n == 0) {
			System.out.println(x);
			System.exit(0);
		}
		List<Integer> list = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		boolean bool = true;
		int i = 0;
		while (bool) {
			if (!list.contains(x - i)) {
				bool = false;
				System.out.println(x - i);
				break;
			}
			if (!list.contains(x + i)) {
				bool = false;
				System.out.println(x + i);
				break;
			}
			i++;
		}
	}
}