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[] pArray = new int[100];
		for (int i = 0; i < 100; i++) {
			pArray[i] = 0;
		}
		int p = 0;
		for (int i = 0; i < n; i++) {
			p = sc.nextInt();
			pArray[p - 1] = 1;
		}
		int ans = 101;

		for (int i = x - 1; i < 100; i++) {
			if (pArray[i] == 0) {
				ans = i + 1;
				break;
			}
		}
		for (int i = x - 1; i >= 0; i--) {
			if (pArray[i] == 0) {
				if (Math.abs(x - ans) < Math.abs(x - (i + 1))) {
					break;
				}
				ans = i + 1;
				break;
			}
			if (i == 0 && Math.abs(x - ans) >= x) {
				ans = 0;
			}
		}
		System.out.println(ans);
	}
} 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[] pArray = new int[100];
		for (int i = 0; i < 100; i++) {
			pArray[i] = 0;
		}
		int p = 0;
		for (int i = 0; i < n; i++) {
			p = sc.nextInt();
			pArray[p - 1] = 1;
		}
		int ans = 101;

		for (int i = x - 1; i < 100; i++) {
			if (pArray[i] == 0) {
				ans = i + 1;
				break;
			}
		}
		for (int i = x - 1; i >= 0; i--) {
			if (pArray[i] == 0) {
				if (Math.abs(x - ans) < Math.abs(x - (i + 1))) {
					break;
				}
				ans = i + 1;
				break;
			}
			if (i == 0 && Math.abs(x - ans) >= x) {
				ans = 0;
			}
		}
		System.out.println(ans);
	}
} 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[] pArray = new int[100];
		for (int i = 0; i < 100; i++) {
			pArray[i] = 0;
		}
		int p = 0;
		for (int i = 0; i < n; i++) {
			p = sc.nextInt();
			pArray[p - 1] = 1;
		}
		int ans = 101;

		for (int i = x - 1; i < 100; i++) {
			if (pArray[i] == 0) {
				ans = i + 1;
				break;
			}
		}
		for (int i = x - 1; i >= 0; i--) {
			if (pArray[i] == 0) {
				if (Math.abs(x - ans) < Math.abs(x - (i + 1))) {
					break;
				}
				ans = i + 1;
				break;
			}
			if (i == 0 && Math.abs(x - ans) >= x) {
				ans = 0;
			}
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();
		int n = sc.nextInt();
		if (n == 0) {
			System.out.println(x);
			return;
		}
		int[] pArray = new int[100];
		for (int i = 0; i < 100; i++) {
			pArray[i] = 0;
		}
		int p = 0;
		for (int i = 0; i < n; i++) {
			p = sc.nextInt();
			pArray[p - 1] = 1;
		}
		int ans = 101;

		for (int i = x - 1; i < 100; i++) {
			if (pArray[i] == 0) {
				ans = i + 1;
				break;
			}
		}
		for (int i = x - 1; i >= 0; i--) {
			if (pArray[i] == 0) {
				if (Math.abs(x - ans) < Math.abs(x - (i + 1))) {
					break;
				}
				ans = i + 1;
				break;
			}
			if (i == 0 && Math.abs(x - ans) >= x) {
				ans = 0;
			}
		}
		System.out.println(ans);
	} 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[] pArray = new int[100]; pArray new int[100] 100 for (int i = 0; i < 100; i++) {
			pArray[i] = 0;
		} int i = 0; int i = 0; i 0 i < 100 i 100 i++ i++ i {
			pArray[i] = 0;
		} {
			pArray[i] = 0;
		} pArray[i] = 0 pArray[i] pArray i 0 int p = 0; p 0 for (int i = 0; i < n; i++) {
			p = sc.nextInt();
			pArray[p - 1] = 1;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			p = sc.nextInt();
			pArray[p - 1] = 1;
		} {
			p = sc.nextInt();
			pArray[p - 1] = 1;
		} p = sc.nextInt() p sc.nextInt() sc.nextInt sc pArray[p - 1] = 1 pArray[p - 1] pArray p - 1 p 1 1 int ans = 101; ans 101 for (int i = x - 1; i < 100; i++) {
			if (pArray[i] == 0) {
				ans = i + 1;
				break;
			}
		} int i = x - 1; int i = x - 1; i x - 1 x 1 i < 100 i 100 i++ i++ i {
			if (pArray[i] == 0) {
				ans = i + 1;
				break;
			}
		} {
			if (pArray[i] == 0) {
				ans = i + 1;
				break;
			}
		} if (pArray[i] == 0) {
				ans = i + 1;
				break;
			} pArray[i] == 0 pArray[i] pArray i 0 {
				ans = i + 1;
				break;
			} ans = i + 1 ans i + 1 i 1 break; for (int i = x - 1; i >= 0; i--) {
			if (pArray[i] == 0) {
				if (Math.abs(x - ans) < Math.abs(x - (i + 1))) {
					break;
				}
				ans = i + 1;
				break;
			}
			if (i == 0 && Math.abs(x - ans) >= x) {
				ans = 0;
			}
		} int i = x - 1; int i = x - 1; i x - 1 x 1 i >= 0 i 0 i-- i-- i {
			if (pArray[i] == 0) {
				if (Math.abs(x - ans) < Math.abs(x - (i + 1))) {
					break;
				}
				ans = i + 1;
				break;
			}
			if (i == 0 && Math.abs(x - ans) >= x) {
				ans = 0;
			}
		} {
			if (pArray[i] == 0) {
				if (Math.abs(x - ans) < Math.abs(x - (i + 1))) {
					break;
				}
				ans = i + 1;
				break;
			}
			if (i == 0 && Math.abs(x - ans) >= x) {
				ans = 0;
			}
		} if (pArray[i] == 0) {
				if (Math.abs(x - ans) < Math.abs(x - (i + 1))) {
					break;
				}
				ans = i + 1;
				break;
			} pArray[i] == 0 pArray[i] pArray i 0 {
				if (Math.abs(x - ans) < Math.abs(x - (i + 1))) {
					break;
				}
				ans = i + 1;
				break;
			} if (Math.abs(x - ans) < Math.abs(x - (i + 1))) {
					break;
				} Math.abs(x - ans) < Math.abs(x - (i + 1)) Math.abs(x - ans) Math.abs Math x - ans x ans Math.abs(x - (i + 1)) Math.abs Math x - (i + 1) x (i + 1) i 1 {
					break;
				} break; ans = i + 1 ans i + 1 i 1 break; if (i == 0 && Math.abs(x - ans) >= x) {
				ans = 0;
			} i == 0 && Math.abs(x - ans) >= x i == 0 i 0 Math.abs(x - ans) >= x Math.abs(x - ans) Math.abs Math x - ans x ans x {
				ans = 0;
			} ans = 0 ans 0 System.out.println(ans) System.out.println System.out System System.out ans 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[] pArray = new int[100];
		for (int i = 0; i < 100; i++) {
			pArray[i] = 0;
		}
		int p = 0;
		for (int i = 0; i < n; i++) {
			p = sc.nextInt();
			pArray[p - 1] = 1;
		}
		int ans = 101;

		for (int i = x - 1; i < 100; i++) {
			if (pArray[i] == 0) {
				ans = i + 1;
				break;
			}
		}
		for (int i = x - 1; i >= 0; i--) {
			if (pArray[i] == 0) {
				if (Math.abs(x - ans) < Math.abs(x - (i + 1))) {
					break;
				}
				ans = i + 1;
				break;
			}
			if (i == 0 && Math.abs(x - ans) >= x) {
				ans = 0;
			}
		}
		System.out.println(ans);
	}
} 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[] pArray = new int[100];
		for (int i = 0; i < 100; i++) {
			pArray[i] = 0;
		}
		int p = 0;
		for (int i = 0; i < n; i++) {
			p = sc.nextInt();
			pArray[p - 1] = 1;
		}
		int ans = 101;

		for (int i = x - 1; i < 100; i++) {
			if (pArray[i] == 0) {
				ans = i + 1;
				break;
			}
		}
		for (int i = x - 1; i >= 0; i--) {
			if (pArray[i] == 0) {
				if (Math.abs(x - ans) < Math.abs(x - (i + 1))) {
					break;
				}
				ans = i + 1;
				break;
			}
			if (i == 0 && Math.abs(x - ans) >= x) {
				ans = 0;
			}
		}
		System.out.println(ans);
	}
} 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[] pArray = new int[100];
		for (int i = 0; i < 100; i++) {
			pArray[i] = 0;
		}
		int p = 0;
		for (int i = 0; i < n; i++) {
			p = sc.nextInt();
			pArray[p - 1] = 1;
		}
		int ans = 101;

		for (int i = x - 1; i < 100; i++) {
			if (pArray[i] == 0) {
				ans = i + 1;
				break;
			}
		}
		for (int i = x - 1; i >= 0; i--) {
			if (pArray[i] == 0) {
				if (Math.abs(x - ans) < Math.abs(x - (i + 1))) {
					break;
				}
				ans = i + 1;
				break;
			}
			if (i == 0 && Math.abs(x - ans) >= x) {
				ans = 0;
			}
		}
		System.out.println(ans);
	}
}