import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();

//		int[] nums = new int[N];
		List<Integer> nums = new ArrayList<Integer>();
		for (int i=0; i<N; i++) {
			int c = sc.nextInt();
			nums.add(c);
		}

//		int[] num_range = new int[110];
		List<Integer> range = new ArrayList<Integer>();
		for (int k=-50; k<51; k++) {
			range.add(X+k);
		}

		List<Integer> answer = new ArrayList<Integer>();

		for (int a : range) {
			if (!(nums.contains(a))) {
				answer.add(a);
			}
		}

		int min_abs=0;
		int before_min_abs = 51;
		int ans_num=0;
		for (int i=0; i<answer.size(); i++) {
			min_abs = Math.abs(answer.get(i) - X);
			if (min_abs<before_min_abs) {
				before_min_abs = min_abs;
				ans_num=answer.get(i);
			}
		}
		System.out.println(ans_num);


	}

} import java.util.ArrayList; ArrayList 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) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();

//		int[] nums = new int[N];
		List<Integer> nums = new ArrayList<Integer>();
		for (int i=0; i<N; i++) {
			int c = sc.nextInt();
			nums.add(c);
		}

//		int[] num_range = new int[110];
		List<Integer> range = new ArrayList<Integer>();
		for (int k=-50; k<51; k++) {
			range.add(X+k);
		}

		List<Integer> answer = new ArrayList<Integer>();

		for (int a : range) {
			if (!(nums.contains(a))) {
				answer.add(a);
			}
		}

		int min_abs=0;
		int before_min_abs = 51;
		int ans_num=0;
		for (int i=0; i<answer.size(); i++) {
			min_abs = Math.abs(answer.get(i) - X);
			if (min_abs<before_min_abs) {
				before_min_abs = min_abs;
				ans_num=answer.get(i);
			}
		}
		System.out.println(ans_num);


	}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();

//		int[] nums = new int[N];
		List<Integer> nums = new ArrayList<Integer>();
		for (int i=0; i<N; i++) {
			int c = sc.nextInt();
			nums.add(c);
		}

//		int[] num_range = new int[110];
		List<Integer> range = new ArrayList<Integer>();
		for (int k=-50; k<51; k++) {
			range.add(X+k);
		}

		List<Integer> answer = new ArrayList<Integer>();

		for (int a : range) {
			if (!(nums.contains(a))) {
				answer.add(a);
			}
		}

		int min_abs=0;
		int before_min_abs = 51;
		int ans_num=0;
		for (int i=0; i<answer.size(); i++) {
			min_abs = Math.abs(answer.get(i) - X);
			if (min_abs<before_min_abs) {
				before_min_abs = min_abs;
				ans_num=answer.get(i);
			}
		}
		System.out.println(ans_num);


	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();

//		int[] nums = new int[N];
		List<Integer> nums = new ArrayList<Integer>();
		for (int i=0; i<N; i++) {
			int c = sc.nextInt();
			nums.add(c);
		}

//		int[] num_range = new int[110];
		List<Integer> range = new ArrayList<Integer>();
		for (int k=-50; k<51; k++) {
			range.add(X+k);
		}

		List<Integer> answer = new ArrayList<Integer>();

		for (int a : range) {
			if (!(nums.contains(a))) {
				answer.add(a);
			}
		}

		int min_abs=0;
		int before_min_abs = 51;
		int ans_num=0;
		for (int i=0; i<answer.size(); i++) {
			min_abs = Math.abs(answer.get(i) - X);
			if (min_abs<before_min_abs) {
				before_min_abs = min_abs;
				ans_num=answer.get(i);
			}
		}
		System.out.println(ans_num);


	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int X = sc.nextInt(); X sc.nextInt() sc.nextInt sc int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc List<Integer> nums = new ArrayList<Integer>(); nums new ArrayList<Integer>() for (int i=0; i<N; i++) {
			int c = sc.nextInt();
			nums.add(c);
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			int c = sc.nextInt();
			nums.add(c);
		} {
			int c = sc.nextInt();
			nums.add(c);
		} int c = sc.nextInt(); c sc.nextInt() sc.nextInt sc nums.add(c) nums.add nums c List<Integer> range = new ArrayList<Integer>(); range new ArrayList<Integer>() for (int k=-50; k<51; k++) {
			range.add(X+k);
		} int k=-50; int k=-50; k -50 50 k<51 k 51 k++ k++ k {
			range.add(X+k);
		} {
			range.add(X+k);
		} range.add(X+k) range.add range X+k X k List<Integer> answer = new ArrayList<Integer>(); answer new ArrayList<Integer>() for (int a : range) {
			if (!(nums.contains(a))) {
				answer.add(a);
			}
		} int a range {
			if (!(nums.contains(a))) {
				answer.add(a);
			}
		} {
			if (!(nums.contains(a))) {
				answer.add(a);
			}
		} if (!(nums.contains(a))) {
				answer.add(a);
			} !(nums.contains(a)) (nums.contains(a)) nums.contains nums a {
				answer.add(a);
			} answer.add(a) answer.add answer a int min_abs=0; min_abs 0 int before_min_abs = 51; before_min_abs 51 int ans_num=0; ans_num 0 for (int i=0; i<answer.size(); i++) {
			min_abs = Math.abs(answer.get(i) - X);
			if (min_abs<before_min_abs) {
				before_min_abs = min_abs;
				ans_num=answer.get(i);
			}
		} int i=0; int i=0; i 0 i<answer.size() i answer.size() answer.size answer i++ i++ i {
			min_abs = Math.abs(answer.get(i) - X);
			if (min_abs<before_min_abs) {
				before_min_abs = min_abs;
				ans_num=answer.get(i);
			}
		} {
			min_abs = Math.abs(answer.get(i) - X);
			if (min_abs<before_min_abs) {
				before_min_abs = min_abs;
				ans_num=answer.get(i);
			}
		} min_abs = Math.abs(answer.get(i) - X) min_abs Math.abs(answer.get(i) - X) Math.abs Math answer.get(i) - X answer.get(i) answer.get answer i X if (min_abs<before_min_abs) {
				before_min_abs = min_abs;
				ans_num=answer.get(i);
			} min_abs<before_min_abs min_abs before_min_abs {
				before_min_abs = min_abs;
				ans_num=answer.get(i);
			} before_min_abs = min_abs before_min_abs min_abs ans_num=answer.get(i) ans_num answer.get(i) answer.get answer i System.out.println(ans_num) System.out.println System.out System System.out ans_num String[] args args public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();

//		int[] nums = new int[N];
		List<Integer> nums = new ArrayList<Integer>();
		for (int i=0; i<N; i++) {
			int c = sc.nextInt();
			nums.add(c);
		}

//		int[] num_range = new int[110];
		List<Integer> range = new ArrayList<Integer>();
		for (int k=-50; k<51; k++) {
			range.add(X+k);
		}

		List<Integer> answer = new ArrayList<Integer>();

		for (int a : range) {
			if (!(nums.contains(a))) {
				answer.add(a);
			}
		}

		int min_abs=0;
		int before_min_abs = 51;
		int ans_num=0;
		for (int i=0; i<answer.size(); i++) {
			min_abs = Math.abs(answer.get(i) - X);
			if (min_abs<before_min_abs) {
				before_min_abs = min_abs;
				ans_num=answer.get(i);
			}
		}
		System.out.println(ans_num);


	}

} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();

//		int[] nums = new int[N];
		List<Integer> nums = new ArrayList<Integer>();
		for (int i=0; i<N; i++) {
			int c = sc.nextInt();
			nums.add(c);
		}

//		int[] num_range = new int[110];
		List<Integer> range = new ArrayList<Integer>();
		for (int k=-50; k<51; k++) {
			range.add(X+k);
		}

		List<Integer> answer = new ArrayList<Integer>();

		for (int a : range) {
			if (!(nums.contains(a))) {
				answer.add(a);
			}
		}

		int min_abs=0;
		int before_min_abs = 51;
		int ans_num=0;
		for (int i=0; i<answer.size(); i++) {
			min_abs = Math.abs(answer.get(i) - X);
			if (min_abs<before_min_abs) {
				before_min_abs = min_abs;
				ans_num=answer.get(i);
			}
		}
		System.out.println(ans_num);


	}

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

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();

//		int[] nums = new int[N];
		List<Integer> nums = new ArrayList<Integer>();
		for (int i=0; i<N; i++) {
			int c = sc.nextInt();
			nums.add(c);
		}

//		int[] num_range = new int[110];
		List<Integer> range = new ArrayList<Integer>();
		for (int k=-50; k<51; k++) {
			range.add(X+k);
		}

		List<Integer> answer = new ArrayList<Integer>();

		for (int a : range) {
			if (!(nums.contains(a))) {
				answer.add(a);
			}
		}

		int min_abs=0;
		int before_min_abs = 51;
		int ans_num=0;
		for (int i=0; i<answer.size(); i++) {
			min_abs = Math.abs(answer.get(i) - X);
			if (min_abs<before_min_abs) {
				before_min_abs = min_abs;
				ans_num=answer.get(i);
			}
		}
		System.out.println(ans_num);


	}

}