import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int X = scan.nextInt();
		int N = scan.nextInt();
		int[] box = new int[N];
		int con=0;
		int min = X+100;
		int judge=0;
		int nbox;
		
		for(int i=0;i<N;i++) {
			box[i] = scan.nextInt();
			if(X==box[i]) {
				con=1;
			}
		}
		
		if(con==0) {
			System.out.print(X);
		}
		else {
			for(int i=1;i<=200-X;i++) {
				int a = X-i;
				int b = X+i;
				int acount=0;
				int bcount=0;
				if(a<=min||b<=min) {
					acount=0;
					bcount=0;
					for(int j=0;j<N;j++) {
						if(box[j] != a) {
							acount += 1;
						}
						if(box[j] != b) {
							bcount += 1;
							
							
						}
					}
					if(acount==N) {
						min=a;
						break;
					}
					else if(bcount==N) {
						min=b;
						break;
					}
				}
				
			}
			System.out.print(min);
		}



	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int X = scan.nextInt();
		int N = scan.nextInt();
		int[] box = new int[N];
		int con=0;
		int min = X+100;
		int judge=0;
		int nbox;
		
		for(int i=0;i<N;i++) {
			box[i] = scan.nextInt();
			if(X==box[i]) {
				con=1;
			}
		}
		
		if(con==0) {
			System.out.print(X);
		}
		else {
			for(int i=1;i<=200-X;i++) {
				int a = X-i;
				int b = X+i;
				int acount=0;
				int bcount=0;
				if(a<=min||b<=min) {
					acount=0;
					bcount=0;
					for(int j=0;j<N;j++) {
						if(box[j] != a) {
							acount += 1;
						}
						if(box[j] != b) {
							bcount += 1;
							
							
						}
					}
					if(acount==N) {
						min=a;
						break;
					}
					else if(bcount==N) {
						min=b;
						break;
					}
				}
				
			}
			System.out.print(min);
		}



	}

} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int X = scan.nextInt();
		int N = scan.nextInt();
		int[] box = new int[N];
		int con=0;
		int min = X+100;
		int judge=0;
		int nbox;
		
		for(int i=0;i<N;i++) {
			box[i] = scan.nextInt();
			if(X==box[i]) {
				con=1;
			}
		}
		
		if(con==0) {
			System.out.print(X);
		}
		else {
			for(int i=1;i<=200-X;i++) {
				int a = X-i;
				int b = X+i;
				int acount=0;
				int bcount=0;
				if(a<=min||b<=min) {
					acount=0;
					bcount=0;
					for(int j=0;j<N;j++) {
						if(box[j] != a) {
							acount += 1;
						}
						if(box[j] != b) {
							bcount += 1;
							
							
						}
					}
					if(acount==N) {
						min=a;
						break;
					}
					else if(bcount==N) {
						min=b;
						break;
					}
				}
				
			}
			System.out.print(min);
		}



	} main {
		Scanner scan = new Scanner(System.in);

		int X = scan.nextInt();
		int N = scan.nextInt();
		int[] box = new int[N];
		int con=0;
		int min = X+100;
		int judge=0;
		int nbox;
		
		for(int i=0;i<N;i++) {
			box[i] = scan.nextInt();
			if(X==box[i]) {
				con=1;
			}
		}
		
		if(con==0) {
			System.out.print(X);
		}
		else {
			for(int i=1;i<=200-X;i++) {
				int a = X-i;
				int b = X+i;
				int acount=0;
				int bcount=0;
				if(a<=min||b<=min) {
					acount=0;
					bcount=0;
					for(int j=0;j<N;j++) {
						if(box[j] != a) {
							acount += 1;
						}
						if(box[j] != b) {
							bcount += 1;
							
							
						}
					}
					if(acount==N) {
						min=a;
						break;
					}
					else if(bcount==N) {
						min=b;
						break;
					}
				}
				
			}
			System.out.print(min);
		}



	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int X = scan.nextInt(); X scan.nextInt() scan.nextInt scan int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan int[] box = new int[N]; box new int[N] N int con=0; con 0 int min = X+100; min X+100 X 100 int judge=0; judge 0 int nbox; nbox for(int i=0;i<N;i++) {
			box[i] = scan.nextInt();
			if(X==box[i]) {
				con=1;
			}
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			box[i] = scan.nextInt();
			if(X==box[i]) {
				con=1;
			}
		} {
			box[i] = scan.nextInt();
			if(X==box[i]) {
				con=1;
			}
		} box[i] = scan.nextInt() box[i] box i scan.nextInt() scan.nextInt scan if(X==box[i]) {
				con=1;
			} X==box[i] X box[i] box i {
				con=1;
			} con=1 con 1 if(con==0) {
			System.out.print(X);
		}
		else {
			for(int i=1;i<=200-X;i++) {
				int a = X-i;
				int b = X+i;
				int acount=0;
				int bcount=0;
				if(a<=min||b<=min) {
					acount=0;
					bcount=0;
					for(int j=0;j<N;j++) {
						if(box[j] != a) {
							acount += 1;
						}
						if(box[j] != b) {
							bcount += 1;
							
							
						}
					}
					if(acount==N) {
						min=a;
						break;
					}
					else if(bcount==N) {
						min=b;
						break;
					}
				}
				
			}
			System.out.print(min);
		} con==0 con 0 {
			System.out.print(X);
		} System.out.print(X) System.out.print System.out System System.out X {
			for(int i=1;i<=200-X;i++) {
				int a = X-i;
				int b = X+i;
				int acount=0;
				int bcount=0;
				if(a<=min||b<=min) {
					acount=0;
					bcount=0;
					for(int j=0;j<N;j++) {
						if(box[j] != a) {
							acount += 1;
						}
						if(box[j] != b) {
							bcount += 1;
							
							
						}
					}
					if(acount==N) {
						min=a;
						break;
					}
					else if(bcount==N) {
						min=b;
						break;
					}
				}
				
			}
			System.out.print(min);
		} for(int i=1;i<=200-X;i++) {
				int a = X-i;
				int b = X+i;
				int acount=0;
				int bcount=0;
				if(a<=min||b<=min) {
					acount=0;
					bcount=0;
					for(int j=0;j<N;j++) {
						if(box[j] != a) {
							acount += 1;
						}
						if(box[j] != b) {
							bcount += 1;
							
							
						}
					}
					if(acount==N) {
						min=a;
						break;
					}
					else if(bcount==N) {
						min=b;
						break;
					}
				}
				
			} int i=1; int i=1; i 1 i<=200-X i 200-X 200 X i++ i++ i {
				int a = X-i;
				int b = X+i;
				int acount=0;
				int bcount=0;
				if(a<=min||b<=min) {
					acount=0;
					bcount=0;
					for(int j=0;j<N;j++) {
						if(box[j] != a) {
							acount += 1;
						}
						if(box[j] != b) {
							bcount += 1;
							
							
						}
					}
					if(acount==N) {
						min=a;
						break;
					}
					else if(bcount==N) {
						min=b;
						break;
					}
				}
				
			} {
				int a = X-i;
				int b = X+i;
				int acount=0;
				int bcount=0;
				if(a<=min||b<=min) {
					acount=0;
					bcount=0;
					for(int j=0;j<N;j++) {
						if(box[j] != a) {
							acount += 1;
						}
						if(box[j] != b) {
							bcount += 1;
							
							
						}
					}
					if(acount==N) {
						min=a;
						break;
					}
					else if(bcount==N) {
						min=b;
						break;
					}
				}
				
			} int a = X-i; a X-i X i int b = X+i; b X+i X i int acount=0; acount 0 int bcount=0; bcount 0 if(a<=min||b<=min) {
					acount=0;
					bcount=0;
					for(int j=0;j<N;j++) {
						if(box[j] != a) {
							acount += 1;
						}
						if(box[j] != b) {
							bcount += 1;
							
							
						}
					}
					if(acount==N) {
						min=a;
						break;
					}
					else if(bcount==N) {
						min=b;
						break;
					}
				} a<=min||b<=min a<=min a min b<=min b min {
					acount=0;
					bcount=0;
					for(int j=0;j<N;j++) {
						if(box[j] != a) {
							acount += 1;
						}
						if(box[j] != b) {
							bcount += 1;
							
							
						}
					}
					if(acount==N) {
						min=a;
						break;
					}
					else if(bcount==N) {
						min=b;
						break;
					}
				} acount=0 acount 0 bcount=0 bcount 0 for(int j=0;j<N;j++) {
						if(box[j] != a) {
							acount += 1;
						}
						if(box[j] != b) {
							bcount += 1;
							
							
						}
					} int j=0; int j=0; j 0 j<N j N j++ j++ j {
						if(box[j] != a) {
							acount += 1;
						}
						if(box[j] != b) {
							bcount += 1;
							
							
						}
					} {
						if(box[j] != a) {
							acount += 1;
						}
						if(box[j] != b) {
							bcount += 1;
							
							
						}
					} if(box[j] != a) {
							acount += 1;
						} box[j] != a box[j] box j a {
							acount += 1;
						} acount += 1 acount 1 if(box[j] != b) {
							bcount += 1;
							
							
						} box[j] != b box[j] box j b {
							bcount += 1;
							
							
						} bcount += 1 bcount 1 if(acount==N) {
						min=a;
						break;
					}
					else if(bcount==N) {
						min=b;
						break;
					} acount==N acount N {
						min=a;
						break;
					} min=a min a break; if(bcount==N) {
						min=b;
						break;
					} bcount==N bcount N {
						min=b;
						break;
					} min=b min b break; System.out.print(min) System.out.print System.out System System.out min String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int X = scan.nextInt();
		int N = scan.nextInt();
		int[] box = new int[N];
		int con=0;
		int min = X+100;
		int judge=0;
		int nbox;
		
		for(int i=0;i<N;i++) {
			box[i] = scan.nextInt();
			if(X==box[i]) {
				con=1;
			}
		}
		
		if(con==0) {
			System.out.print(X);
		}
		else {
			for(int i=1;i<=200-X;i++) {
				int a = X-i;
				int b = X+i;
				int acount=0;
				int bcount=0;
				if(a<=min||b<=min) {
					acount=0;
					bcount=0;
					for(int j=0;j<N;j++) {
						if(box[j] != a) {
							acount += 1;
						}
						if(box[j] != b) {
							bcount += 1;
							
							
						}
					}
					if(acount==N) {
						min=a;
						break;
					}
					else if(bcount==N) {
						min=b;
						break;
					}
				}
				
			}
			System.out.print(min);
		}



	}

} public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int X = scan.nextInt();
		int N = scan.nextInt();
		int[] box = new int[N];
		int con=0;
		int min = X+100;
		int judge=0;
		int nbox;
		
		for(int i=0;i<N;i++) {
			box[i] = scan.nextInt();
			if(X==box[i]) {
				con=1;
			}
		}
		
		if(con==0) {
			System.out.print(X);
		}
		else {
			for(int i=1;i<=200-X;i++) {
				int a = X-i;
				int b = X+i;
				int acount=0;
				int bcount=0;
				if(a<=min||b<=min) {
					acount=0;
					bcount=0;
					for(int j=0;j<N;j++) {
						if(box[j] != a) {
							acount += 1;
						}
						if(box[j] != b) {
							bcount += 1;
							
							
						}
					}
					if(acount==N) {
						min=a;
						break;
					}
					else if(bcount==N) {
						min=b;
						break;
					}
				}
				
			}
			System.out.print(min);
		}



	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int X = scan.nextInt();
		int N = scan.nextInt();
		int[] box = new int[N];
		int con=0;
		int min = X+100;
		int judge=0;
		int nbox;
		
		for(int i=0;i<N;i++) {
			box[i] = scan.nextInt();
			if(X==box[i]) {
				con=1;
			}
		}
		
		if(con==0) {
			System.out.print(X);
		}
		else {
			for(int i=1;i<=200-X;i++) {
				int a = X-i;
				int b = X+i;
				int acount=0;
				int bcount=0;
				if(a<=min||b<=min) {
					acount=0;
					bcount=0;
					for(int j=0;j<N;j++) {
						if(box[j] != a) {
							acount += 1;
						}
						if(box[j] != b) {
							bcount += 1;
							
							
						}
					}
					if(acount==N) {
						min=a;
						break;
					}
					else if(bcount==N) {
						min=b;
						break;
					}
				}
				
			}
			System.out.print(min);
		}



	}

}