import java.util.Arrays;
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();
		Integer[] p = new Integer[N];
		int b = 1000;
		int d = 0;
		for(int i=0; i<N; i++) {
			p[i] = sc.nextInt();
		}
		sc.close();
		for(int i=0; i<X*2; i++) {
			if(Arrays.asList(p).contains(i)) {
				continue;
			}else {
					int c = Math.abs(X-i);
					if(b>c) {
						b = c;
						d = i;
					}
				}
			}
		System.out.println(d);
	}

} import java.util.Arrays; Arrays java.util 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();
		Integer[] p = new Integer[N];
		int b = 1000;
		int d = 0;
		for(int i=0; i<N; i++) {
			p[i] = sc.nextInt();
		}
		sc.close();
		for(int i=0; i<X*2; i++) {
			if(Arrays.asList(p).contains(i)) {
				continue;
			}else {
					int c = Math.abs(X-i);
					if(b>c) {
						b = c;
						d = i;
					}
				}
			}
		System.out.println(d);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();
		Integer[] p = new Integer[N];
		int b = 1000;
		int d = 0;
		for(int i=0; i<N; i++) {
			p[i] = sc.nextInt();
		}
		sc.close();
		for(int i=0; i<X*2; i++) {
			if(Arrays.asList(p).contains(i)) {
				continue;
			}else {
					int c = Math.abs(X-i);
					if(b>c) {
						b = c;
						d = i;
					}
				}
			}
		System.out.println(d);
	} main {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();
		Integer[] p = new Integer[N];
		int b = 1000;
		int d = 0;
		for(int i=0; i<N; i++) {
			p[i] = sc.nextInt();
		}
		sc.close();
		for(int i=0; i<X*2; i++) {
			if(Arrays.asList(p).contains(i)) {
				continue;
			}else {
					int c = Math.abs(X-i);
					if(b>c) {
						b = c;
						d = i;
					}
				}
			}
		System.out.println(d);
	} 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 Integer[] p = new Integer[N]; p new Integer[N] N int b = 1000; b 1000 int d = 0; d 0 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 sc.close() sc.close sc for(int i=0; i<X*2; i++) {
			if(Arrays.asList(p).contains(i)) {
				continue;
			}else {
					int c = Math.abs(X-i);
					if(b>c) {
						b = c;
						d = i;
					}
				}
			} int i=0; int i=0; i 0 i<X*2 i X*2 X 2 i++ i++ i {
			if(Arrays.asList(p).contains(i)) {
				continue;
			}else {
					int c = Math.abs(X-i);
					if(b>c) {
						b = c;
						d = i;
					}
				}
			} {
			if(Arrays.asList(p).contains(i)) {
				continue;
			}else {
					int c = Math.abs(X-i);
					if(b>c) {
						b = c;
						d = i;
					}
				}
			} if(Arrays.asList(p).contains(i)) {
				continue;
			}else {
					int c = Math.abs(X-i);
					if(b>c) {
						b = c;
						d = i;
					}
				} Arrays.asList(p).contains(i) Arrays.asList(p).contains Arrays.asList(p) Arrays.asList Arrays p i {
				continue;
			} continue; {
					int c = Math.abs(X-i);
					if(b>c) {
						b = c;
						d = i;
					}
				} int c = Math.abs(X-i); c Math.abs(X-i) Math.abs Math X-i X i if(b>c) {
						b = c;
						d = i;
					} b>c b c {
						b = c;
						d = i;
					} b = c b c d = i d i System.out.println(d) System.out.println System.out System System.out d 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();
		Integer[] p = new Integer[N];
		int b = 1000;
		int d = 0;
		for(int i=0; i<N; i++) {
			p[i] = sc.nextInt();
		}
		sc.close();
		for(int i=0; i<X*2; i++) {
			if(Arrays.asList(p).contains(i)) {
				continue;
			}else {
					int c = Math.abs(X-i);
					if(b>c) {
						b = c;
						d = i;
					}
				}
			}
		System.out.println(d);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();
		Integer[] p = new Integer[N];
		int b = 1000;
		int d = 0;
		for(int i=0; i<N; i++) {
			p[i] = sc.nextInt();
		}
		sc.close();
		for(int i=0; i<X*2; i++) {
			if(Arrays.asList(p).contains(i)) {
				continue;
			}else {
					int c = Math.abs(X-i);
					if(b>c) {
						b = c;
						d = i;
					}
				}
			}
		System.out.println(d);
	}

} Main
import java.util.Arrays;
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();
		Integer[] p = new Integer[N];
		int b = 1000;
		int d = 0;
		for(int i=0; i<N; i++) {
			p[i] = sc.nextInt();
		}
		sc.close();
		for(int i=0; i<X*2; i++) {
			if(Arrays.asList(p).contains(i)) {
				continue;
			}else {
					int c = Math.abs(X-i);
					if(b>c) {
						b = c;
						d = i;
					}
				}
			}
		System.out.println(d);
	}

}
