import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		String[] tmp = scanner.nextLine().split(" ");
		int x = Integer.parseInt(tmp[0]);
		int n = Integer.parseInt(tmp[1]);

		String[] tmp1 = scanner.nextLine().split(" ");
		int[] list = new int[102];
		int a = 0;
		list[0] = 0;
 		for(int i = 0; i < n; i++) {

			a = Integer.parseInt(tmp1[i]);

			list[a]++;

		}

		int ans = 101;
		int count = 101;
		for(int i = 101; i >= 0; i --) {


			if(list[i] != 1) {

				ans = Math.min(ans, Math.abs(x - i));

				if(ans == Math.abs(x - i)) {

					count = Math.min(count, i);

				}
			}

		}

		System.out.println(count);


	}

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

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		String[] tmp = scanner.nextLine().split(" ");
		int x = Integer.parseInt(tmp[0]);
		int n = Integer.parseInt(tmp[1]);

		String[] tmp1 = scanner.nextLine().split(" ");
		int[] list = new int[102];
		int a = 0;
		list[0] = 0;
 		for(int i = 0; i < n; i++) {

			a = Integer.parseInt(tmp1[i]);

			list[a]++;

		}

		int ans = 101;
		int count = 101;
		for(int i = 101; i >= 0; i --) {


			if(list[i] != 1) {

				ans = Math.min(ans, Math.abs(x - i));

				if(ans == Math.abs(x - i)) {

					count = Math.min(count, i);

				}
			}

		}

		System.out.println(count);


	}

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

		Scanner scanner = new Scanner(System.in);

		String[] tmp = scanner.nextLine().split(" ");
		int x = Integer.parseInt(tmp[0]);
		int n = Integer.parseInt(tmp[1]);

		String[] tmp1 = scanner.nextLine().split(" ");
		int[] list = new int[102];
		int a = 0;
		list[0] = 0;
 		for(int i = 0; i < n; i++) {

			a = Integer.parseInt(tmp1[i]);

			list[a]++;

		}

		int ans = 101;
		int count = 101;
		for(int i = 101; i >= 0; i --) {


			if(list[i] != 1) {

				ans = Math.min(ans, Math.abs(x - i));

				if(ans == Math.abs(x - i)) {

					count = Math.min(count, i);

				}
			}

		}

		System.out.println(count);


	} main {

		Scanner scanner = new Scanner(System.in);

		String[] tmp = scanner.nextLine().split(" ");
		int x = Integer.parseInt(tmp[0]);
		int n = Integer.parseInt(tmp[1]);

		String[] tmp1 = scanner.nextLine().split(" ");
		int[] list = new int[102];
		int a = 0;
		list[0] = 0;
 		for(int i = 0; i < n; i++) {

			a = Integer.parseInt(tmp1[i]);

			list[a]++;

		}

		int ans = 101;
		int count = 101;
		for(int i = 101; i >= 0; i --) {


			if(list[i] != 1) {

				ans = Math.min(ans, Math.abs(x - i));

				if(ans == Math.abs(x - i)) {

					count = Math.min(count, i);

				}
			}

		}

		System.out.println(count);


	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String[] tmp = scanner.nextLine().split(" "); tmp scanner.nextLine().split(" ") scanner.nextLine().split scanner.nextLine() scanner.nextLine scanner " " int x = Integer.parseInt(tmp[0]); x Integer.parseInt(tmp[0]) Integer.parseInt Integer tmp[0] tmp 0 int n = Integer.parseInt(tmp[1]); n Integer.parseInt(tmp[1]) Integer.parseInt Integer tmp[1] tmp 1 String[] tmp1 = scanner.nextLine().split(" "); tmp1 scanner.nextLine().split(" ") scanner.nextLine().split scanner.nextLine() scanner.nextLine scanner " " int[] list = new int[102]; list new int[102] 102 int a = 0; a 0 list[0] = 0 list[0] list 0 0 for(int i = 0; i < n; i++) {

			a = Integer.parseInt(tmp1[i]);

			list[a]++;

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

			a = Integer.parseInt(tmp1[i]);

			list[a]++;

		} {

			a = Integer.parseInt(tmp1[i]);

			list[a]++;

		} a = Integer.parseInt(tmp1[i]) a Integer.parseInt(tmp1[i]) Integer.parseInt Integer tmp1[i] tmp1 i list[a]++ list[a] list a int ans = 101; ans 101 int count = 101; count 101 for(int i = 101; i >= 0; i --) {


			if(list[i] != 1) {

				ans = Math.min(ans, Math.abs(x - i));

				if(ans == Math.abs(x - i)) {

					count = Math.min(count, i);

				}
			}

		} int i = 101; int i = 101; i 101 i >= 0 i 0 i -- i -- i {


			if(list[i] != 1) {

				ans = Math.min(ans, Math.abs(x - i));

				if(ans == Math.abs(x - i)) {

					count = Math.min(count, i);

				}
			}

		} {


			if(list[i] != 1) {

				ans = Math.min(ans, Math.abs(x - i));

				if(ans == Math.abs(x - i)) {

					count = Math.min(count, i);

				}
			}

		} if(list[i] != 1) {

				ans = Math.min(ans, Math.abs(x - i));

				if(ans == Math.abs(x - i)) {

					count = Math.min(count, i);

				}
			} list[i] != 1 list[i] list i 1 {

				ans = Math.min(ans, Math.abs(x - i));

				if(ans == Math.abs(x - i)) {

					count = Math.min(count, i);

				}
			} ans = Math.min(ans, Math.abs(x - i)) ans Math.min(ans, Math.abs(x - i)) Math.min Math ans Math.abs(x - i) Math.abs Math x - i x i if(ans == Math.abs(x - i)) {

					count = Math.min(count, i);

				} ans == Math.abs(x - i) ans Math.abs(x - i) Math.abs Math x - i x i {

					count = Math.min(count, i);

				} count = Math.min(count, i) count Math.min(count, i) Math.min Math count i System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main{

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		String[] tmp = scanner.nextLine().split(" ");
		int x = Integer.parseInt(tmp[0]);
		int n = Integer.parseInt(tmp[1]);

		String[] tmp1 = scanner.nextLine().split(" ");
		int[] list = new int[102];
		int a = 0;
		list[0] = 0;
 		for(int i = 0; i < n; i++) {

			a = Integer.parseInt(tmp1[i]);

			list[a]++;

		}

		int ans = 101;
		int count = 101;
		for(int i = 101; i >= 0; i --) {


			if(list[i] != 1) {

				ans = Math.min(ans, Math.abs(x - i));

				if(ans == Math.abs(x - i)) {

					count = Math.min(count, i);

				}
			}

		}

		System.out.println(count);


	}

} public class Main{

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		String[] tmp = scanner.nextLine().split(" ");
		int x = Integer.parseInt(tmp[0]);
		int n = Integer.parseInt(tmp[1]);

		String[] tmp1 = scanner.nextLine().split(" ");
		int[] list = new int[102];
		int a = 0;
		list[0] = 0;
 		for(int i = 0; i < n; i++) {

			a = Integer.parseInt(tmp1[i]);

			list[a]++;

		}

		int ans = 101;
		int count = 101;
		for(int i = 101; i >= 0; i --) {


			if(list[i] != 1) {

				ans = Math.min(ans, Math.abs(x - i));

				if(ans == Math.abs(x - i)) {

					count = Math.min(count, i);

				}
			}

		}

		System.out.println(count);


	}

} Main
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		String[] tmp = scanner.nextLine().split(" ");
		int x = Integer.parseInt(tmp[0]);
		int n = Integer.parseInt(tmp[1]);

		String[] tmp1 = scanner.nextLine().split(" ");
		int[] list = new int[102];
		int a = 0;
		list[0] = 0;
 		for(int i = 0; i < n; i++) {

			a = Integer.parseInt(tmp1[i]);

			list[a]++;

		}

		int ans = 101;
		int count = 101;
		for(int i = 101; i >= 0; i --) {


			if(list[i] != 1) {

				ans = Math.min(ans, Math.abs(x - i));

				if(ans == Math.abs(x - i)) {

					count = Math.min(count, i);

				}
			}

		}

		System.out.println(count);


	}

}
