import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if (b==0) {
			System.out.println(a);
			return;
		}
		int [] c = new int[b];
		String str = sc.nextLine();
		int min = 100;
		int ans = 0;
		for (int i=0; i<b; i++) {
			c[i]= sc.nextInt();
		}
		int f = 0;
		for (int i=-101; i<201; i++) {
			for (int j=0; j<b; j++) {
				if (c[j]==i) {
					f = 1;
					break;
				}
			}
			if (f == 0) {
				if(Math.abs(i-a) < min) {
					min = Math.abs(i-a);
					ans = i;
				}
			} else {
				f = 0;
			}
		}

		sc.close();
		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 a = sc.nextInt();
		int b = sc.nextInt();
		if (b==0) {
			System.out.println(a);
			return;
		}
		int [] c = new int[b];
		String str = sc.nextLine();
		int min = 100;
		int ans = 0;
		for (int i=0; i<b; i++) {
			c[i]= sc.nextInt();
		}
		int f = 0;
		for (int i=-101; i<201; i++) {
			for (int j=0; j<b; j++) {
				if (c[j]==i) {
					f = 1;
					break;
				}
			}
			if (f == 0) {
				if(Math.abs(i-a) < min) {
					min = Math.abs(i-a);
					ans = i;
				}
			} else {
				f = 0;
			}
		}

		sc.close();
		System.out.println(ans);
	}
} Main public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if (b==0) {
			System.out.println(a);
			return;
		}
		int [] c = new int[b];
		String str = sc.nextLine();
		int min = 100;
		int ans = 0;
		for (int i=0; i<b; i++) {
			c[i]= sc.nextInt();
		}
		int f = 0;
		for (int i=-101; i<201; i++) {
			for (int j=0; j<b; j++) {
				if (c[j]==i) {
					f = 1;
					break;
				}
			}
			if (f == 0) {
				if(Math.abs(i-a) < min) {
					min = Math.abs(i-a);
					ans = i;
				}
			} else {
				f = 0;
			}
		}

		sc.close();
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if (b==0) {
			System.out.println(a);
			return;
		}
		int [] c = new int[b];
		String str = sc.nextLine();
		int min = 100;
		int ans = 0;
		for (int i=0; i<b; i++) {
			c[i]= sc.nextInt();
		}
		int f = 0;
		for (int i=-101; i<201; i++) {
			for (int j=0; j<b; j++) {
				if (c[j]==i) {
					f = 1;
					break;
				}
			}
			if (f == 0) {
				if(Math.abs(i-a) < min) {
					min = Math.abs(i-a);
					ans = i;
				}
			} else {
				f = 0;
			}
		}

		sc.close();
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc if (b==0) {
			System.out.println(a);
			return;
		} b==0 b 0 {
			System.out.println(a);
			return;
		} System.out.println(a) System.out.println System.out System System.out a return; int [] c = new int[b]; c new int[b] b String str = sc.nextLine(); str sc.nextLine() sc.nextLine sc int min = 100; min 100 int ans = 0; ans 0 for (int i=0; i<b; i++) {
			c[i]= sc.nextInt();
		} int i=0; int i=0; i 0 i<b i b i++ i++ i {
			c[i]= sc.nextInt();
		} {
			c[i]= sc.nextInt();
		} c[i]= sc.nextInt() c[i] c i sc.nextInt() sc.nextInt sc int f = 0; f 0 for (int i=-101; i<201; i++) {
			for (int j=0; j<b; j++) {
				if (c[j]==i) {
					f = 1;
					break;
				}
			}
			if (f == 0) {
				if(Math.abs(i-a) < min) {
					min = Math.abs(i-a);
					ans = i;
				}
			} else {
				f = 0;
			}
		} int i=-101; int i=-101; i -101 101 i<201 i 201 i++ i++ i {
			for (int j=0; j<b; j++) {
				if (c[j]==i) {
					f = 1;
					break;
				}
			}
			if (f == 0) {
				if(Math.abs(i-a) < min) {
					min = Math.abs(i-a);
					ans = i;
				}
			} else {
				f = 0;
			}
		} {
			for (int j=0; j<b; j++) {
				if (c[j]==i) {
					f = 1;
					break;
				}
			}
			if (f == 0) {
				if(Math.abs(i-a) < min) {
					min = Math.abs(i-a);
					ans = i;
				}
			} else {
				f = 0;
			}
		} for (int j=0; j<b; j++) {
				if (c[j]==i) {
					f = 1;
					break;
				}
			} int j=0; int j=0; j 0 j<b j b j++ j++ j {
				if (c[j]==i) {
					f = 1;
					break;
				}
			} {
				if (c[j]==i) {
					f = 1;
					break;
				}
			} if (c[j]==i) {
					f = 1;
					break;
				} c[j]==i c[j] c j i {
					f = 1;
					break;
				} f = 1 f 1 break; if (f == 0) {
				if(Math.abs(i-a) < min) {
					min = Math.abs(i-a);
					ans = i;
				}
			} else {
				f = 0;
			} f == 0 f 0 {
				if(Math.abs(i-a) < min) {
					min = Math.abs(i-a);
					ans = i;
				}
			} if(Math.abs(i-a) < min) {
					min = Math.abs(i-a);
					ans = i;
				} Math.abs(i-a) < min Math.abs(i-a) Math.abs Math i-a i a min {
					min = Math.abs(i-a);
					ans = i;
				} min = Math.abs(i-a) min Math.abs(i-a) Math.abs Math i-a i a ans = i ans i {
				f = 0;
			} f = 0 f 0 sc.close() sc.close sc 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 a = sc.nextInt();
		int b = sc.nextInt();
		if (b==0) {
			System.out.println(a);
			return;
		}
		int [] c = new int[b];
		String str = sc.nextLine();
		int min = 100;
		int ans = 0;
		for (int i=0; i<b; i++) {
			c[i]= sc.nextInt();
		}
		int f = 0;
		for (int i=-101; i<201; i++) {
			for (int j=0; j<b; j++) {
				if (c[j]==i) {
					f = 1;
					break;
				}
			}
			if (f == 0) {
				if(Math.abs(i-a) < min) {
					min = Math.abs(i-a);
					ans = i;
				}
			} else {
				f = 0;
			}
		}

		sc.close();
		System.out.println(ans);
	}
} public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if (b==0) {
			System.out.println(a);
			return;
		}
		int [] c = new int[b];
		String str = sc.nextLine();
		int min = 100;
		int ans = 0;
		for (int i=0; i<b; i++) {
			c[i]= sc.nextInt();
		}
		int f = 0;
		for (int i=-101; i<201; i++) {
			for (int j=0; j<b; j++) {
				if (c[j]==i) {
					f = 1;
					break;
				}
			}
			if (f == 0) {
				if(Math.abs(i-a) < min) {
					min = Math.abs(i-a);
					ans = i;
				}
			} else {
				f = 0;
			}
		}

		sc.close();
		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 a = sc.nextInt();
		int b = sc.nextInt();
		if (b==0) {
			System.out.println(a);
			return;
		}
		int [] c = new int[b];
		String str = sc.nextLine();
		int min = 100;
		int ans = 0;
		for (int i=0; i<b; i++) {
			c[i]= sc.nextInt();
		}
		int f = 0;
		for (int i=-101; i<201; i++) {
			for (int j=0; j<b; j++) {
				if (c[j]==i) {
					f = 1;
					break;
				}
			}
			if (f == 0) {
				if(Math.abs(i-a) < min) {
					min = Math.abs(i-a);
					ans = i;
				}
			} else {
				f = 0;
			}
		}

		sc.close();
		System.out.println(ans);
	}
}
