import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		//スキャナー
		Scanner s = new Scanner(System.in);


		int numx = s.nextInt();
		int numn = s.nextInt();

		if(numn == 0) {

			System.out.println(numx);

			s.close();

			System.exit(0);
		}
		Integer[] array = new Integer[numn];

		for(int i = 0 ; i < numn ; i++) {

			array[i] = s.nextInt();

		}

		//リストへ変換
		List<Integer> listNum = Arrays.asList(array);

		//スキャナーを閉じる
		s.close();

		//answer
		int ans = 0;

		boolean flg_con = true;

		if(! listNum.contains(numx)) {
			//同数が配列にいない場合
			ans = numx;
			
			flg_con = false;
		}

		int count = 0;

		while(flg_con) {

			count++;

			int mnx = numx - count;
			int plx = numx + count;

			if(! listNum.contains(mnx)) {

				ans = mnx;

				flg_con = false;
			}else if (! listNum.contains(plx)) {

				ans = plx;

				flg_con=false;
			}

		}

		System.out.println(ans);
	}

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

	public static void main(String[] args) {

		//スキャナー
		Scanner s = new Scanner(System.in);


		int numx = s.nextInt();
		int numn = s.nextInt();

		if(numn == 0) {

			System.out.println(numx);

			s.close();

			System.exit(0);
		}
		Integer[] array = new Integer[numn];

		for(int i = 0 ; i < numn ; i++) {

			array[i] = s.nextInt();

		}

		//リストへ変換
		List<Integer> listNum = Arrays.asList(array);

		//スキャナーを閉じる
		s.close();

		//answer
		int ans = 0;

		boolean flg_con = true;

		if(! listNum.contains(numx)) {
			//同数が配列にいない場合
			ans = numx;
			
			flg_con = false;
		}

		int count = 0;

		while(flg_con) {

			count++;

			int mnx = numx - count;
			int plx = numx + count;

			if(! listNum.contains(mnx)) {

				ans = mnx;

				flg_con = false;
			}else if (! listNum.contains(plx)) {

				ans = plx;

				flg_con=false;
			}

		}

		System.out.println(ans);
	}

} Main public static void main(String[] args) {

		//スキャナー
		Scanner s = new Scanner(System.in);


		int numx = s.nextInt();
		int numn = s.nextInt();

		if(numn == 0) {

			System.out.println(numx);

			s.close();

			System.exit(0);
		}
		Integer[] array = new Integer[numn];

		for(int i = 0 ; i < numn ; i++) {

			array[i] = s.nextInt();

		}

		//リストへ変換
		List<Integer> listNum = Arrays.asList(array);

		//スキャナーを閉じる
		s.close();

		//answer
		int ans = 0;

		boolean flg_con = true;

		if(! listNum.contains(numx)) {
			//同数が配列にいない場合
			ans = numx;
			
			flg_con = false;
		}

		int count = 0;

		while(flg_con) {

			count++;

			int mnx = numx - count;
			int plx = numx + count;

			if(! listNum.contains(mnx)) {

				ans = mnx;

				flg_con = false;
			}else if (! listNum.contains(plx)) {

				ans = plx;

				flg_con=false;
			}

		}

		System.out.println(ans);
	} main {

		//スキャナー
		Scanner s = new Scanner(System.in);


		int numx = s.nextInt();
		int numn = s.nextInt();

		if(numn == 0) {

			System.out.println(numx);

			s.close();

			System.exit(0);
		}
		Integer[] array = new Integer[numn];

		for(int i = 0 ; i < numn ; i++) {

			array[i] = s.nextInt();

		}

		//リストへ変換
		List<Integer> listNum = Arrays.asList(array);

		//スキャナーを閉じる
		s.close();

		//answer
		int ans = 0;

		boolean flg_con = true;

		if(! listNum.contains(numx)) {
			//同数が配列にいない場合
			ans = numx;
			
			flg_con = false;
		}

		int count = 0;

		while(flg_con) {

			count++;

			int mnx = numx - count;
			int plx = numx + count;

			if(! listNum.contains(mnx)) {

				ans = mnx;

				flg_con = false;
			}else if (! listNum.contains(plx)) {

				ans = plx;

				flg_con=false;
			}

		}

		System.out.println(ans);
	} Scanner s = new Scanner(System.in); s new Scanner(System.in) int numx = s.nextInt(); numx s.nextInt() s.nextInt s int numn = s.nextInt(); numn s.nextInt() s.nextInt s if(numn == 0) {

			System.out.println(numx);

			s.close();

			System.exit(0);
		} numn == 0 numn 0 {

			System.out.println(numx);

			s.close();

			System.exit(0);
		} System.out.println(numx) System.out.println System.out System System.out numx s.close() s.close s System.exit(0) System.exit System 0 Integer[] array = new Integer[numn]; array new Integer[numn] numn for(int i = 0 ; i < numn ; i++) {

			array[i] = s.nextInt();

		} int i = 0 ; int i = 0 ; i 0 i < numn i numn i++ i++ i {

			array[i] = s.nextInt();

		} {

			array[i] = s.nextInt();

		} array[i] = s.nextInt() array[i] array i s.nextInt() s.nextInt s List<Integer> listNum = Arrays.asList(array); listNum Arrays.asList(array) Arrays.asList Arrays array s.close() s.close s int ans = 0; ans 0 boolean flg_con = true; flg_con true if(! listNum.contains(numx)) {
			//同数が配列にいない場合
			ans = numx;
			
			flg_con = false;
		} ! listNum.contains(numx) listNum.contains(numx) listNum.contains listNum numx {
			//同数が配列にいない場合
			ans = numx;
			
			flg_con = false;
		} ans = numx ans numx flg_con = false flg_con false int count = 0; count 0 while(flg_con) {

			count++;

			int mnx = numx - count;
			int plx = numx + count;

			if(! listNum.contains(mnx)) {

				ans = mnx;

				flg_con = false;
			}else if (! listNum.contains(plx)) {

				ans = plx;

				flg_con=false;
			}

		} flg_con {

			count++;

			int mnx = numx - count;
			int plx = numx + count;

			if(! listNum.contains(mnx)) {

				ans = mnx;

				flg_con = false;
			}else if (! listNum.contains(plx)) {

				ans = plx;

				flg_con=false;
			}

		} count++ count int mnx = numx - count; mnx numx - count numx count int plx = numx + count; plx numx + count numx count if(! listNum.contains(mnx)) {

				ans = mnx;

				flg_con = false;
			}else if (! listNum.contains(plx)) {

				ans = plx;

				flg_con=false;
			} ! listNum.contains(mnx) listNum.contains(mnx) listNum.contains listNum mnx {

				ans = mnx;

				flg_con = false;
			} ans = mnx ans mnx flg_con = false flg_con false if (! listNum.contains(plx)) {

				ans = plx;

				flg_con=false;
			} ! listNum.contains(plx) listNum.contains(plx) listNum.contains listNum plx {

				ans = plx;

				flg_con=false;
			} ans = plx ans plx flg_con=false flg_con false 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 s = new Scanner(System.in);


		int numx = s.nextInt();
		int numn = s.nextInt();

		if(numn == 0) {

			System.out.println(numx);

			s.close();

			System.exit(0);
		}
		Integer[] array = new Integer[numn];

		for(int i = 0 ; i < numn ; i++) {

			array[i] = s.nextInt();

		}

		//リストへ変換
		List<Integer> listNum = Arrays.asList(array);

		//スキャナーを閉じる
		s.close();

		//answer
		int ans = 0;

		boolean flg_con = true;

		if(! listNum.contains(numx)) {
			//同数が配列にいない場合
			ans = numx;
			
			flg_con = false;
		}

		int count = 0;

		while(flg_con) {

			count++;

			int mnx = numx - count;
			int plx = numx + count;

			if(! listNum.contains(mnx)) {

				ans = mnx;

				flg_con = false;
			}else if (! listNum.contains(plx)) {

				ans = plx;

				flg_con=false;
			}

		}

		System.out.println(ans);
	}

} public class Main {

	public static void main(String[] args) {

		//スキャナー
		Scanner s = new Scanner(System.in);


		int numx = s.nextInt();
		int numn = s.nextInt();

		if(numn == 0) {

			System.out.println(numx);

			s.close();

			System.exit(0);
		}
		Integer[] array = new Integer[numn];

		for(int i = 0 ; i < numn ; i++) {

			array[i] = s.nextInt();

		}

		//リストへ変換
		List<Integer> listNum = Arrays.asList(array);

		//スキャナーを閉じる
		s.close();

		//answer
		int ans = 0;

		boolean flg_con = true;

		if(! listNum.contains(numx)) {
			//同数が配列にいない場合
			ans = numx;
			
			flg_con = false;
		}

		int count = 0;

		while(flg_con) {

			count++;

			int mnx = numx - count;
			int plx = numx + count;

			if(! listNum.contains(mnx)) {

				ans = mnx;

				flg_con = false;
			}else if (! listNum.contains(plx)) {

				ans = plx;

				flg_con=false;
			}

		}

		System.out.println(ans);
	}

} Main
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		//スキャナー
		Scanner s = new Scanner(System.in);


		int numx = s.nextInt();
		int numn = s.nextInt();

		if(numn == 0) {

			System.out.println(numx);

			s.close();

			System.exit(0);
		}
		Integer[] array = new Integer[numn];

		for(int i = 0 ; i < numn ; i++) {

			array[i] = s.nextInt();

		}

		//リストへ変換
		List<Integer> listNum = Arrays.asList(array);

		//スキャナーを閉じる
		s.close();

		//answer
		int ans = 0;

		boolean flg_con = true;

		if(! listNum.contains(numx)) {
			//同数が配列にいない場合
			ans = numx;
			
			flg_con = false;
		}

		int count = 0;

		while(flg_con) {

			count++;

			int mnx = numx - count;
			int plx = numx + count;

			if(! listNum.contains(mnx)) {

				ans = mnx;

				flg_con = false;
			}else if (! listNum.contains(plx)) {

				ans = plx;

				flg_con=false;
			}

		}

		System.out.println(ans);
	}

}
