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);
			return;
		}

		int p [] = new int [n];

		for(int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}


		int ans = x;
		for(int i = 0; i < 101; i++) {
			boolean t = true;
			for(int j = 0; j < n; j++) {
				if(p[j] == ans) {
					t = false;
				}
			}
			if(t) {
				System.out.println(ans);
				return;
			}

			if(i % 2 == 0) {
				ans -= (i + 1);

			}else {
				ans += (i + 1);
			}
		}
	}
} 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);
			return;
		}

		int p [] = new int [n];

		for(int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}


		int ans = x;
		for(int i = 0; i < 101; i++) {
			boolean t = true;
			for(int j = 0; j < n; j++) {
				if(p[j] == ans) {
					t = false;
				}
			}
			if(t) {
				System.out.println(ans);
				return;
			}

			if(i % 2 == 0) {
				ans -= (i + 1);

			}else {
				ans += (i + 1);
			}
		}
	}
} 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);
			return;
		}

		int p [] = new int [n];

		for(int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}


		int ans = x;
		for(int i = 0; i < 101; i++) {
			boolean t = true;
			for(int j = 0; j < n; j++) {
				if(p[j] == ans) {
					t = false;
				}
			}
			if(t) {
				System.out.println(ans);
				return;
			}

			if(i % 2 == 0) {
				ans -= (i + 1);

			}else {
				ans += (i + 1);
			}
		}
	} main {
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();
		int n = sc.nextInt();
		if(n == 0) {
			System.out.println(x);
			return;
		}

		int p [] = new int [n];

		for(int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}


		int ans = x;
		for(int i = 0; i < 101; i++) {
			boolean t = true;
			for(int j = 0; j < n; j++) {
				if(p[j] == ans) {
					t = false;
				}
			}
			if(t) {
				System.out.println(ans);
				return;
			}

			if(i % 2 == 0) {
				ans -= (i + 1);

			}else {
				ans += (i + 1);
			}
		}
	} 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);
			return;
		} n == 0 n 0 {
			System.out.println(x);
			return;
		} System.out.println(x) System.out.println System.out System System.out x return; int p [] = new int [n]; p new int [n] n for(int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			p[i] = sc.nextInt();
		} {
			p[i] = sc.nextInt();
		} p[i] = sc.nextInt() p[i] p i sc.nextInt() sc.nextInt sc int ans = x; ans x for(int i = 0; i < 101; i++) {
			boolean t = true;
			for(int j = 0; j < n; j++) {
				if(p[j] == ans) {
					t = false;
				}
			}
			if(t) {
				System.out.println(ans);
				return;
			}

			if(i % 2 == 0) {
				ans -= (i + 1);

			}else {
				ans += (i + 1);
			}
		} int i = 0; int i = 0; i 0 i < 101 i 101 i++ i++ i {
			boolean t = true;
			for(int j = 0; j < n; j++) {
				if(p[j] == ans) {
					t = false;
				}
			}
			if(t) {
				System.out.println(ans);
				return;
			}

			if(i % 2 == 0) {
				ans -= (i + 1);

			}else {
				ans += (i + 1);
			}
		} {
			boolean t = true;
			for(int j = 0; j < n; j++) {
				if(p[j] == ans) {
					t = false;
				}
			}
			if(t) {
				System.out.println(ans);
				return;
			}

			if(i % 2 == 0) {
				ans -= (i + 1);

			}else {
				ans += (i + 1);
			}
		} boolean t = true; t true for(int j = 0; j < n; j++) {
				if(p[j] == ans) {
					t = false;
				}
			} int j = 0; int j = 0; j 0 j < n j n j++ j++ j {
				if(p[j] == ans) {
					t = false;
				}
			} {
				if(p[j] == ans) {
					t = false;
				}
			} if(p[j] == ans) {
					t = false;
				} p[j] == ans p[j] p j ans {
					t = false;
				} t = false t false if(t) {
				System.out.println(ans);
				return;
			} t {
				System.out.println(ans);
				return;
			} System.out.println(ans) System.out.println System.out System System.out ans return; if(i % 2 == 0) {
				ans -= (i + 1);

			}else {
				ans += (i + 1);
			} i % 2 == 0 i % 2 i 2 0 {
				ans -= (i + 1);

			} ans -= (i + 1) ans (i + 1) i 1 {
				ans += (i + 1);
			} ans += (i + 1) ans (i + 1) i 1 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);
			return;
		}

		int p [] = new int [n];

		for(int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}


		int ans = x;
		for(int i = 0; i < 101; i++) {
			boolean t = true;
			for(int j = 0; j < n; j++) {
				if(p[j] == ans) {
					t = false;
				}
			}
			if(t) {
				System.out.println(ans);
				return;
			}

			if(i % 2 == 0) {
				ans -= (i + 1);

			}else {
				ans += (i + 1);
			}
		}
	}
} 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);
			return;
		}

		int p [] = new int [n];

		for(int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}


		int ans = x;
		for(int i = 0; i < 101; i++) {
			boolean t = true;
			for(int j = 0; j < n; j++) {
				if(p[j] == ans) {
					t = false;
				}
			}
			if(t) {
				System.out.println(ans);
				return;
			}

			if(i % 2 == 0) {
				ans -= (i + 1);

			}else {
				ans += (i + 1);
			}
		}
	}
} Main
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);
			return;
		}

		int p [] = new int [n];

		for(int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}


		int ans = x;
		for(int i = 0; i < 101; i++) {
			boolean t = true;
			for(int j = 0; j < n; j++) {
				if(p[j] == ans) {
					t = false;
				}
			}
			if(t) {
				System.out.println(ans);
				return;
			}

			if(i % 2 == 0) {
				ans -= (i + 1);

			}else {
				ans += (i + 1);
			}
		}
	}
}