import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		int n = scan.nextInt();

		if (n == 0) {
			System.out.println(x);
			System.exit(0);
		}

		List<Integer> p = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			p.add(scan.nextInt());
		}

		int y1;
		int y2;

		for (int i = 0; i <= 100; i++) {
			y1 = x - i;
			y2 = x + i;

			if (p.contains(y1)) {
				if (p.contains(y2)) {

				} else {
					System.out.println(y2);
					break;
				}
			} else {
				System.out.println(y1);
				break;
			}
		}

		scan.close();

	}

} 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 scan = new Scanner(System.in);
		int x = scan.nextInt();
		int n = scan.nextInt();

		if (n == 0) {
			System.out.println(x);
			System.exit(0);
		}

		List<Integer> p = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			p.add(scan.nextInt());
		}

		int y1;
		int y2;

		for (int i = 0; i <= 100; i++) {
			y1 = x - i;
			y2 = x + i;

			if (p.contains(y1)) {
				if (p.contains(y2)) {

				} else {
					System.out.println(y2);
					break;
				}
			} else {
				System.out.println(y1);
				break;
			}
		}

		scan.close();

	}

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

		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		int n = scan.nextInt();

		if (n == 0) {
			System.out.println(x);
			System.exit(0);
		}

		List<Integer> p = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			p.add(scan.nextInt());
		}

		int y1;
		int y2;

		for (int i = 0; i <= 100; i++) {
			y1 = x - i;
			y2 = x + i;

			if (p.contains(y1)) {
				if (p.contains(y2)) {

				} else {
					System.out.println(y2);
					break;
				}
			} else {
				System.out.println(y1);
				break;
			}
		}

		scan.close();

	} main {

		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		int n = scan.nextInt();

		if (n == 0) {
			System.out.println(x);
			System.exit(0);
		}

		List<Integer> p = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			p.add(scan.nextInt());
		}

		int y1;
		int y2;

		for (int i = 0; i <= 100; i++) {
			y1 = x - i;
			y2 = x + i;

			if (p.contains(y1)) {
				if (p.contains(y2)) {

				} else {
					System.out.println(y2);
					break;
				}
			} else {
				System.out.println(y1);
				break;
			}
		}

		scan.close();

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int x = scan.nextInt(); x scan.nextInt() scan.nextInt scan int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan 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> p = new ArrayList<>(); p new ArrayList<>() for (int i = 0; i < n; i++) {
			p.add(scan.nextInt());
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			p.add(scan.nextInt());
		} {
			p.add(scan.nextInt());
		} p.add(scan.nextInt()) p.add p scan.nextInt() scan.nextInt scan int y1; y1 int y2; y2 for (int i = 0; i <= 100; i++) {
			y1 = x - i;
			y2 = x + i;

			if (p.contains(y1)) {
				if (p.contains(y2)) {

				} else {
					System.out.println(y2);
					break;
				}
			} else {
				System.out.println(y1);
				break;
			}
		} int i = 0; int i = 0; i 0 i <= 100 i 100 i++ i++ i {
			y1 = x - i;
			y2 = x + i;

			if (p.contains(y1)) {
				if (p.contains(y2)) {

				} else {
					System.out.println(y2);
					break;
				}
			} else {
				System.out.println(y1);
				break;
			}
		} {
			y1 = x - i;
			y2 = x + i;

			if (p.contains(y1)) {
				if (p.contains(y2)) {

				} else {
					System.out.println(y2);
					break;
				}
			} else {
				System.out.println(y1);
				break;
			}
		} y1 = x - i y1 x - i x i y2 = x + i y2 x + i x i if (p.contains(y1)) {
				if (p.contains(y2)) {

				} else {
					System.out.println(y2);
					break;
				}
			} else {
				System.out.println(y1);
				break;
			} p.contains(y1) p.contains p y1 {
				if (p.contains(y2)) {

				} else {
					System.out.println(y2);
					break;
				}
			} if (p.contains(y2)) {

				} else {
					System.out.println(y2);
					break;
				} p.contains(y2) p.contains p y2 {

				} {
					System.out.println(y2);
					break;
				} System.out.println(y2) System.out.println System.out System System.out y2 break; {
				System.out.println(y1);
				break;
			} System.out.println(y1) System.out.println System.out System System.out y1 break; scan.close() scan.close scan String[] args args public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		int n = scan.nextInt();

		if (n == 0) {
			System.out.println(x);
			System.exit(0);
		}

		List<Integer> p = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			p.add(scan.nextInt());
		}

		int y1;
		int y2;

		for (int i = 0; i <= 100; i++) {
			y1 = x - i;
			y2 = x + i;

			if (p.contains(y1)) {
				if (p.contains(y2)) {

				} else {
					System.out.println(y2);
					break;
				}
			} else {
				System.out.println(y1);
				break;
			}
		}

		scan.close();

	}

} public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		int n = scan.nextInt();

		if (n == 0) {
			System.out.println(x);
			System.exit(0);
		}

		List<Integer> p = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			p.add(scan.nextInt());
		}

		int y1;
		int y2;

		for (int i = 0; i <= 100; i++) {
			y1 = x - i;
			y2 = x + i;

			if (p.contains(y1)) {
				if (p.contains(y2)) {

				} else {
					System.out.println(y2);
					break;
				}
			} else {
				System.out.println(y1);
				break;
			}
		}

		scan.close();

	}

} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		int n = scan.nextInt();

		if (n == 0) {
			System.out.println(x);
			System.exit(0);
		}

		List<Integer> p = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			p.add(scan.nextInt());
		}

		int y1;
		int y2;

		for (int i = 0; i <= 100; i++) {
			y1 = x - i;
			y2 = x + i;

			if (p.contains(y1)) {
				if (p.contains(y2)) {

				} else {
					System.out.println(y2);
					break;
				}
			} else {
				System.out.println(y1);
				break;
			}
		}

		scan.close();

	}

}
