import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

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);
			sc.close();
			return;
		}
		
		Set<Integer> p = new HashSet<>();
		for (int i = 0; i < N; i++) {
			p.add(sc.nextInt());
		}
		
		// 結果の出力
		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;
			}
		}

		sc.close();
	}
} import java.util.HashSet; HashSet java.util import java.util.Scanner; Scanner java.util import java.util.Set; Set 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);
			sc.close();
			return;
		}
		
		Set<Integer> p = new HashSet<>();
		for (int i = 0; i < N; i++) {
			p.add(sc.nextInt());
		}
		
		// 結果の出力
		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;
			}
		}

		sc.close();
	}
} 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);
			sc.close();
			return;
		}
		
		Set<Integer> p = new HashSet<>();
		for (int i = 0; i < N; i++) {
			p.add(sc.nextInt());
		}
		
		// 結果の出力
		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;
			}
		}

		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);

		// 入力値の取得
		int X = sc.nextInt();
		int N = sc.nextInt();
		
		if (N == 0) {
			System.out.println(X);
			sc.close();
			return;
		}
		
		Set<Integer> p = new HashSet<>();
		for (int i = 0; i < N; i++) {
			p.add(sc.nextInt());
		}
		
		// 結果の出力
		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;
			}
		}

		sc.close();
	} 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);
			sc.close();
			return;
		} N == 0 N 0 {
			System.out.println(X);
			sc.close();
			return;
		} System.out.println(X) System.out.println System.out System System.out X sc.close() sc.close sc return; Set<Integer> p = new HashSet<>(); p new HashSet<>() for (int i = 0; i < N; i++) {
			p.add(sc.nextInt());
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			p.add(sc.nextInt());
		} {
			p.add(sc.nextInt());
		} p.add(sc.nextInt()) p.add p sc.nextInt() sc.nextInt sc 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; sc.close() sc.close sc 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);
			sc.close();
			return;
		}
		
		Set<Integer> p = new HashSet<>();
		for (int i = 0; i < N; i++) {
			p.add(sc.nextInt());
		}
		
		// 結果の出力
		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;
			}
		}

		sc.close();
	}
} 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);
			sc.close();
			return;
		}
		
		Set<Integer> p = new HashSet<>();
		for (int i = 0; i < N; i++) {
			p.add(sc.nextInt());
		}
		
		// 結果の出力
		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;
			}
		}

		sc.close();
	}
} Main
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

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);
			sc.close();
			return;
		}
		
		Set<Integer> p = new HashSet<>();
		for (int i = 0; i < N; i++) {
			p.add(sc.nextInt());
		}
		
		// 結果の出力
		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;
			}
		}

		sc.close();
	}
}
