import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X,N;
		X=sc.nextInt();
		N=sc.nextInt();

		int syoki_hairetu[] = new int[301];
		for(int i=0;i<301;i++) {
			syoki_hairetu[i]=-100+i;
		}


		int p[]=new int[N];
		for(int i=0;i<N;i++) {
			p[i]=sc.nextInt();
			syoki_hairetu[100+p[i]]=-101;
		}

		int tmp;
		int min_abs=1000;
		int min_number=1000;

		for(int i=0;i<301;i++) {
			tmp=Math.abs(X-syoki_hairetu[i]);
			if(tmp<min_abs) {
				min_abs=tmp;
				min_number=syoki_hairetu[i];
			}
		}
		System.out.println(min_number);
		/*for(int i=0;i<301;i++) {
			System.out.print(syoki_hairetu[i]+" ");

		}*/
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X,N;
		X=sc.nextInt();
		N=sc.nextInt();

		int syoki_hairetu[] = new int[301];
		for(int i=0;i<301;i++) {
			syoki_hairetu[i]=-100+i;
		}


		int p[]=new int[N];
		for(int i=0;i<N;i++) {
			p[i]=sc.nextInt();
			syoki_hairetu[100+p[i]]=-101;
		}

		int tmp;
		int min_abs=1000;
		int min_number=1000;

		for(int i=0;i<301;i++) {
			tmp=Math.abs(X-syoki_hairetu[i]);
			if(tmp<min_abs) {
				min_abs=tmp;
				min_number=syoki_hairetu[i];
			}
		}
		System.out.println(min_number);
		/*for(int i=0;i<301;i++) {
			System.out.print(syoki_hairetu[i]+" ");

		}*/
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X,N;
		X=sc.nextInt();
		N=sc.nextInt();

		int syoki_hairetu[] = new int[301];
		for(int i=0;i<301;i++) {
			syoki_hairetu[i]=-100+i;
		}


		int p[]=new int[N];
		for(int i=0;i<N;i++) {
			p[i]=sc.nextInt();
			syoki_hairetu[100+p[i]]=-101;
		}

		int tmp;
		int min_abs=1000;
		int min_number=1000;

		for(int i=0;i<301;i++) {
			tmp=Math.abs(X-syoki_hairetu[i]);
			if(tmp<min_abs) {
				min_abs=tmp;
				min_number=syoki_hairetu[i];
			}
		}
		System.out.println(min_number);
		/*for(int i=0;i<301;i++) {
			System.out.print(syoki_hairetu[i]+" ");

		}*/
	} main {
		Scanner sc = new Scanner(System.in);
		int X,N;
		X=sc.nextInt();
		N=sc.nextInt();

		int syoki_hairetu[] = new int[301];
		for(int i=0;i<301;i++) {
			syoki_hairetu[i]=-100+i;
		}


		int p[]=new int[N];
		for(int i=0;i<N;i++) {
			p[i]=sc.nextInt();
			syoki_hairetu[100+p[i]]=-101;
		}

		int tmp;
		int min_abs=1000;
		int min_number=1000;

		for(int i=0;i<301;i++) {
			tmp=Math.abs(X-syoki_hairetu[i]);
			if(tmp<min_abs) {
				min_abs=tmp;
				min_number=syoki_hairetu[i];
			}
		}
		System.out.println(min_number);
		/*for(int i=0;i<301;i++) {
			System.out.print(syoki_hairetu[i]+" ");

		}*/
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int X X N; N X=sc.nextInt() X sc.nextInt() sc.nextInt sc N=sc.nextInt() N sc.nextInt() sc.nextInt sc int syoki_hairetu[] = new int[301]; syoki_hairetu new int[301] 301 for(int i=0;i<301;i++) {
			syoki_hairetu[i]=-100+i;
		} int i=0; int i=0; i 0 i<301 i 301 i++ i++ i {
			syoki_hairetu[i]=-100+i;
		} {
			syoki_hairetu[i]=-100+i;
		} syoki_hairetu[i]=-100+i syoki_hairetu[i] syoki_hairetu i -100+i -100 100 i int p[]=new int[N]; p new int[N] N for(int i=0;i<N;i++) {
			p[i]=sc.nextInt();
			syoki_hairetu[100+p[i]]=-101;
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			p[i]=sc.nextInt();
			syoki_hairetu[100+p[i]]=-101;
		} {
			p[i]=sc.nextInt();
			syoki_hairetu[100+p[i]]=-101;
		} p[i]=sc.nextInt() p[i] p i sc.nextInt() sc.nextInt sc syoki_hairetu[100+p[i]]=-101 syoki_hairetu[100+p[i]] syoki_hairetu 100+p[i] 100 p[i] p i -101 101 int tmp; tmp int min_abs=1000; min_abs 1000 int min_number=1000; min_number 1000 for(int i=0;i<301;i++) {
			tmp=Math.abs(X-syoki_hairetu[i]);
			if(tmp<min_abs) {
				min_abs=tmp;
				min_number=syoki_hairetu[i];
			}
		} int i=0; int i=0; i 0 i<301 i 301 i++ i++ i {
			tmp=Math.abs(X-syoki_hairetu[i]);
			if(tmp<min_abs) {
				min_abs=tmp;
				min_number=syoki_hairetu[i];
			}
		} {
			tmp=Math.abs(X-syoki_hairetu[i]);
			if(tmp<min_abs) {
				min_abs=tmp;
				min_number=syoki_hairetu[i];
			}
		} tmp=Math.abs(X-syoki_hairetu[i]) tmp Math.abs(X-syoki_hairetu[i]) Math.abs Math X-syoki_hairetu[i] X syoki_hairetu[i] syoki_hairetu i if(tmp<min_abs) {
				min_abs=tmp;
				min_number=syoki_hairetu[i];
			} tmp<min_abs tmp min_abs {
				min_abs=tmp;
				min_number=syoki_hairetu[i];
			} min_abs=tmp min_abs tmp min_number=syoki_hairetu[i] min_number syoki_hairetu[i] syoki_hairetu i System.out.println(min_number) System.out.println System.out System System.out min_number String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X,N;
		X=sc.nextInt();
		N=sc.nextInt();

		int syoki_hairetu[] = new int[301];
		for(int i=0;i<301;i++) {
			syoki_hairetu[i]=-100+i;
		}


		int p[]=new int[N];
		for(int i=0;i<N;i++) {
			p[i]=sc.nextInt();
			syoki_hairetu[100+p[i]]=-101;
		}

		int tmp;
		int min_abs=1000;
		int min_number=1000;

		for(int i=0;i<301;i++) {
			tmp=Math.abs(X-syoki_hairetu[i]);
			if(tmp<min_abs) {
				min_abs=tmp;
				min_number=syoki_hairetu[i];
			}
		}
		System.out.println(min_number);
		/*for(int i=0;i<301;i++) {
			System.out.print(syoki_hairetu[i]+" ");

		}*/
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X,N;
		X=sc.nextInt();
		N=sc.nextInt();

		int syoki_hairetu[] = new int[301];
		for(int i=0;i<301;i++) {
			syoki_hairetu[i]=-100+i;
		}


		int p[]=new int[N];
		for(int i=0;i<N;i++) {
			p[i]=sc.nextInt();
			syoki_hairetu[100+p[i]]=-101;
		}

		int tmp;
		int min_abs=1000;
		int min_number=1000;

		for(int i=0;i<301;i++) {
			tmp=Math.abs(X-syoki_hairetu[i]);
			if(tmp<min_abs) {
				min_abs=tmp;
				min_number=syoki_hairetu[i];
			}
		}
		System.out.println(min_number);
		/*for(int i=0;i<301;i++) {
			System.out.print(syoki_hairetu[i]+" ");

		}*/
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X,N;
		X=sc.nextInt();
		N=sc.nextInt();

		int syoki_hairetu[] = new int[301];
		for(int i=0;i<301;i++) {
			syoki_hairetu[i]=-100+i;
		}


		int p[]=new int[N];
		for(int i=0;i<N;i++) {
			p[i]=sc.nextInt();
			syoki_hairetu[100+p[i]]=-101;
		}

		int tmp;
		int min_abs=1000;
		int min_number=1000;

		for(int i=0;i<301;i++) {
			tmp=Math.abs(X-syoki_hairetu[i]);
			if(tmp<min_abs) {
				min_abs=tmp;
				min_number=syoki_hairetu[i];
			}
		}
		System.out.println(min_number);
		/*for(int i=0;i<301;i++) {
			System.out.print(syoki_hairetu[i]+" ");

		}*/
	}
}
