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();
if(n==0){System.out.println(x);}else{
		int p[] = new int[n];
		int q[] = new int[102 - n];
		q[0] = 0;
		q[101 - n] = 101;
		for (int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}

		Arrays.sort(p);
		int look = 0;
		int lookb = 0;
		for (int i = 0; i <= 101; i++) {
			if (!(p[lookb] == i)) {
				// System.out.println("!"+i);
				q[look] = i;
				look++;

			} else {
				lookb++;
				if (lookb >= n) {
					lookb--;
				}
			}
		}
/*		for (int i = 0; i < q.length; i++) {
			System.out.println(q[i]);
		}
*/
		int sub=x;
		int ans=0;
for(int i=0;i<q.length;i++){
if(sub>Math.abs(q[i]-x)){
	sub=Math.abs(q[i]-x);
	ans=q[i];
}
}System.out.println(ans);
}
	}
} 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();
if(n==0){System.out.println(x);}else{
		int p[] = new int[n];
		int q[] = new int[102 - n];
		q[0] = 0;
		q[101 - n] = 101;
		for (int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}

		Arrays.sort(p);
		int look = 0;
		int lookb = 0;
		for (int i = 0; i <= 101; i++) {
			if (!(p[lookb] == i)) {
				// System.out.println("!"+i);
				q[look] = i;
				look++;

			} else {
				lookb++;
				if (lookb >= n) {
					lookb--;
				}
			}
		}
/*		for (int i = 0; i < q.length; i++) {
			System.out.println(q[i]);
		}
*/
		int sub=x;
		int ans=0;
for(int i=0;i<q.length;i++){
if(sub>Math.abs(q[i]-x)){
	sub=Math.abs(q[i]-x);
	ans=q[i];
}
}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);}else{
		int p[] = new int[n];
		int q[] = new int[102 - n];
		q[0] = 0;
		q[101 - n] = 101;
		for (int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}

		Arrays.sort(p);
		int look = 0;
		int lookb = 0;
		for (int i = 0; i <= 101; i++) {
			if (!(p[lookb] == i)) {
				// System.out.println("!"+i);
				q[look] = i;
				look++;

			} else {
				lookb++;
				if (lookb >= n) {
					lookb--;
				}
			}
		}
/*		for (int i = 0; i < q.length; i++) {
			System.out.println(q[i]);
		}
*/
		int sub=x;
		int ans=0;
for(int i=0;i<q.length;i++){
if(sub>Math.abs(q[i]-x)){
	sub=Math.abs(q[i]-x);
	ans=q[i];
}
}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);}else{
		int p[] = new int[n];
		int q[] = new int[102 - n];
		q[0] = 0;
		q[101 - n] = 101;
		for (int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}

		Arrays.sort(p);
		int look = 0;
		int lookb = 0;
		for (int i = 0; i <= 101; i++) {
			if (!(p[lookb] == i)) {
				// System.out.println("!"+i);
				q[look] = i;
				look++;

			} else {
				lookb++;
				if (lookb >= n) {
					lookb--;
				}
			}
		}
/*		for (int i = 0; i < q.length; i++) {
			System.out.println(q[i]);
		}
*/
		int sub=x;
		int ans=0;
for(int i=0;i<q.length;i++){
if(sub>Math.abs(q[i]-x)){
	sub=Math.abs(q[i]-x);
	ans=q[i];
}
}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);}else{
		int p[] = new int[n];
		int q[] = new int[102 - n];
		q[0] = 0;
		q[101 - n] = 101;
		for (int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}

		Arrays.sort(p);
		int look = 0;
		int lookb = 0;
		for (int i = 0; i <= 101; i++) {
			if (!(p[lookb] == i)) {
				// System.out.println("!"+i);
				q[look] = i;
				look++;

			} else {
				lookb++;
				if (lookb >= n) {
					lookb--;
				}
			}
		}
/*		for (int i = 0; i < q.length; i++) {
			System.out.println(q[i]);
		}
*/
		int sub=x;
		int ans=0;
for(int i=0;i<q.length;i++){
if(sub>Math.abs(q[i]-x)){
	sub=Math.abs(q[i]-x);
	ans=q[i];
}
}System.out.println(ans);
} n==0 n 0 {System.out.println(x);} System.out.println(x) System.out.println System.out System System.out x {
		int p[] = new int[n];
		int q[] = new int[102 - n];
		q[0] = 0;
		q[101 - n] = 101;
		for (int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}

		Arrays.sort(p);
		int look = 0;
		int lookb = 0;
		for (int i = 0; i <= 101; i++) {
			if (!(p[lookb] == i)) {
				// System.out.println("!"+i);
				q[look] = i;
				look++;

			} else {
				lookb++;
				if (lookb >= n) {
					lookb--;
				}
			}
		}
/*		for (int i = 0; i < q.length; i++) {
			System.out.println(q[i]);
		}
*/
		int sub=x;
		int ans=0;
for(int i=0;i<q.length;i++){
if(sub>Math.abs(q[i]-x)){
	sub=Math.abs(q[i]-x);
	ans=q[i];
}
}System.out.println(ans);
} int p[] = new int[n]; p new int[n] n int q[] = new int[102 - n]; q new int[102 - n] 102 - n 102 n q[0] = 0 q[0] q 0 0 q[101 - n] = 101 q[101 - n] q 101 - n 101 n 101 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 Arrays.sort(p) Arrays.sort Arrays p int look = 0; look 0 int lookb = 0; lookb 0 for (int i = 0; i <= 101; i++) {
			if (!(p[lookb] == i)) {
				// System.out.println("!"+i);
				q[look] = i;
				look++;

			} else {
				lookb++;
				if (lookb >= n) {
					lookb--;
				}
			}
		} int i = 0; int i = 0; i 0 i <= 101 i 101 i++ i++ i {
			if (!(p[lookb] == i)) {
				// System.out.println("!"+i);
				q[look] = i;
				look++;

			} else {
				lookb++;
				if (lookb >= n) {
					lookb--;
				}
			}
		} {
			if (!(p[lookb] == i)) {
				// System.out.println("!"+i);
				q[look] = i;
				look++;

			} else {
				lookb++;
				if (lookb >= n) {
					lookb--;
				}
			}
		} if (!(p[lookb] == i)) {
				// System.out.println("!"+i);
				q[look] = i;
				look++;

			} else {
				lookb++;
				if (lookb >= n) {
					lookb--;
				}
			} !(p[lookb] == i) (p[lookb] == i) p[lookb] p lookb i {
				// System.out.println("!"+i);
				q[look] = i;
				look++;

			} q[look] = i q[look] q look i look++ look {
				lookb++;
				if (lookb >= n) {
					lookb--;
				}
			} lookb++ lookb if (lookb >= n) {
					lookb--;
				} lookb >= n lookb n {
					lookb--;
				} lookb-- lookb int sub=x; sub x int ans=0; ans 0 for(int i=0;i<q.length;i++){
if(sub>Math.abs(q[i]-x)){
	sub=Math.abs(q[i]-x);
	ans=q[i];
}
} int i=0; int i=0; i 0 i<q.length i q.length q q.length i++ i++ i {
if(sub>Math.abs(q[i]-x)){
	sub=Math.abs(q[i]-x);
	ans=q[i];
}
} {
if(sub>Math.abs(q[i]-x)){
	sub=Math.abs(q[i]-x);
	ans=q[i];
}
} if(sub>Math.abs(q[i]-x)){
	sub=Math.abs(q[i]-x);
	ans=q[i];
} sub>Math.abs(q[i]-x) sub Math.abs(q[i]-x) Math.abs Math q[i]-x q[i] q i x {
	sub=Math.abs(q[i]-x);
	ans=q[i];
} sub=Math.abs(q[i]-x) sub Math.abs(q[i]-x) Math.abs Math q[i]-x q[i] q i x ans=q[i] ans q[i] q i 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);}else{
		int p[] = new int[n];
		int q[] = new int[102 - n];
		q[0] = 0;
		q[101 - n] = 101;
		for (int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}

		Arrays.sort(p);
		int look = 0;
		int lookb = 0;
		for (int i = 0; i <= 101; i++) {
			if (!(p[lookb] == i)) {
				// System.out.println("!"+i);
				q[look] = i;
				look++;

			} else {
				lookb++;
				if (lookb >= n) {
					lookb--;
				}
			}
		}
/*		for (int i = 0; i < q.length; i++) {
			System.out.println(q[i]);
		}
*/
		int sub=x;
		int ans=0;
for(int i=0;i<q.length;i++){
if(sub>Math.abs(q[i]-x)){
	sub=Math.abs(q[i]-x);
	ans=q[i];
}
}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);}else{
		int p[] = new int[n];
		int q[] = new int[102 - n];
		q[0] = 0;
		q[101 - n] = 101;
		for (int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}

		Arrays.sort(p);
		int look = 0;
		int lookb = 0;
		for (int i = 0; i <= 101; i++) {
			if (!(p[lookb] == i)) {
				// System.out.println("!"+i);
				q[look] = i;
				look++;

			} else {
				lookb++;
				if (lookb >= n) {
					lookb--;
				}
			}
		}
/*		for (int i = 0; i < q.length; i++) {
			System.out.println(q[i]);
		}
*/
		int sub=x;
		int ans=0;
for(int i=0;i<q.length;i++){
if(sub>Math.abs(q[i]-x)){
	sub=Math.abs(q[i]-x);
	ans=q[i];
}
}System.out.println(ans);
}
	}
} 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();
if(n==0){System.out.println(x);}else{
		int p[] = new int[n];
		int q[] = new int[102 - n];
		q[0] = 0;
		q[101 - n] = 101;
		for (int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}

		Arrays.sort(p);
		int look = 0;
		int lookb = 0;
		for (int i = 0; i <= 101; i++) {
			if (!(p[lookb] == i)) {
				// System.out.println("!"+i);
				q[look] = i;
				look++;

			} else {
				lookb++;
				if (lookb >= n) {
					lookb--;
				}
			}
		}
/*		for (int i = 0; i < q.length; i++) {
			System.out.println(q[i]);
		}
*/
		int sub=x;
		int ans=0;
for(int i=0;i<q.length;i++){
if(sub>Math.abs(q[i]-x)){
	sub=Math.abs(q[i]-x);
	ans=q[i];
}
}System.out.println(ans);
}
	}
}