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();
		List<Integer> p = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			int a = scan.nextInt();
			p.add(a);
		}

		for (int i = 0; i < 100; i++) {
			if (!p.contains(x - i)) {
				System.out.println(x - i);
				break;
			} else if (!p.contains(x + i)) {
				System.out.println(x + i);
				break;
			}
		}
	}
} 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();
		List<Integer> p = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			int a = scan.nextInt();
			p.add(a);
		}

		for (int i = 0; i < 100; i++) {
			if (!p.contains(x - i)) {
				System.out.println(x - i);
				break;
			} else if (!p.contains(x + i)) {
				System.out.println(x + i);
				break;
			}
		}
	}
} Main public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

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

		for (int i = 0; i < 100; i++) {
			if (!p.contains(x - i)) {
				System.out.println(x - i);
				break;
			} else if (!p.contains(x + i)) {
				System.out.println(x + i);
				break;
			}
		}
	} main {

		Scanner scan = new Scanner(System.in);

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

		for (int i = 0; i < 100; i++) {
			if (!p.contains(x - i)) {
				System.out.println(x - i);
				break;
			} else if (!p.contains(x + i)) {
				System.out.println(x + i);
				break;
			}
		}
	} 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 List<Integer> p = new ArrayList<>(); p new ArrayList<>() for (int i = 0; i < n; i++) {
			int a = scan.nextInt();
			p.add(a);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			int a = scan.nextInt();
			p.add(a);
		} {
			int a = scan.nextInt();
			p.add(a);
		} int a = scan.nextInt(); a scan.nextInt() scan.nextInt scan p.add(a) p.add p a for (int i = 0; i < 100; i++) {
			if (!p.contains(x - i)) {
				System.out.println(x - i);
				break;
			} else if (!p.contains(x + i)) {
				System.out.println(x + i);
				break;
			}
		} int i = 0; int i = 0; i 0 i < 100 i 100 i++ i++ i {
			if (!p.contains(x - i)) {
				System.out.println(x - i);
				break;
			} else if (!p.contains(x + i)) {
				System.out.println(x + i);
				break;
			}
		} {
			if (!p.contains(x - i)) {
				System.out.println(x - i);
				break;
			} else if (!p.contains(x + i)) {
				System.out.println(x + i);
				break;
			}
		} if (!p.contains(x - i)) {
				System.out.println(x - i);
				break;
			} else if (!p.contains(x + i)) {
				System.out.println(x + i);
				break;
			} !p.contains(x - i) p.contains(x - i) p.contains p x - i x i {
				System.out.println(x - i);
				break;
			} System.out.println(x - i) System.out.println System.out System System.out x - i x i break; if (!p.contains(x + i)) {
				System.out.println(x + i);
				break;
			} !p.contains(x + i) p.contains(x + i) p.contains p x + i x i {
				System.out.println(x + i);
				break;
			} System.out.println(x + i) System.out.println System.out System System.out x + i x i break; 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();
		List<Integer> p = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			int a = scan.nextInt();
			p.add(a);
		}

		for (int i = 0; i < 100; i++) {
			if (!p.contains(x - i)) {
				System.out.println(x - i);
				break;
			} else if (!p.contains(x + i)) {
				System.out.println(x + i);
				break;
			}
		}
	}
} public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

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

		for (int i = 0; i < 100; i++) {
			if (!p.contains(x - i)) {
				System.out.println(x - i);
				break;
			} else if (!p.contains(x + i)) {
				System.out.println(x + i);
				break;
			}
		}
	}
} 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();
		List<Integer> p = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			int a = scan.nextInt();
			p.add(a);
		}

		for (int i = 0; i < 100; i++) {
			if (!p.contains(x - i)) {
				System.out.println(x - i);
				break;
			} else if (!p.contains(x + i)) {
				System.out.println(x + i);
				break;
			}
		}
	}
}