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

public class Main {

	public static void main(String[] args) {

		// 読み込み
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();

		List<Integer> p = new ArrayList<>();
		
		if (N == 0) {
			System.out.println(X);
			return;
		}
		for (int i = 1; i <=N ; i++) {
			p.add(sc.nextInt());
		}
		if (!p.contains(X)) {
			System.out.println(X);
			return;
		}
		
		int cost_l = Math.abs(X - 0);
		int ans_l = 0;
		
		for (int i = X -1; i >= 0 ; i--) {
			if(!p.contains(i)) {
				ans_l = i;
				cost_l = Math.abs(X - i);
				break;
			}
		}
		int cost_r = Math.abs(101 - X);
		int ans_r = 101;
		
		for (int i = X +1; i <= 101  ; i++) {
			if(!p.contains(i)) {
				ans_r = i;
				cost_r = Math.abs(X - i);
				break;
			}
		}		
		
		if(cost_l < cost_r) {
			System.out.println(ans_l);
		}
		else if(cost_l > cost_r) {
			System.out.println(ans_r);
		}
		else {
			System.out.println(ans_l);
		}
		
	}
} 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) {

		// 読み込み
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();

		List<Integer> p = new ArrayList<>();
		
		if (N == 0) {
			System.out.println(X);
			return;
		}
		for (int i = 1; i <=N ; i++) {
			p.add(sc.nextInt());
		}
		if (!p.contains(X)) {
			System.out.println(X);
			return;
		}
		
		int cost_l = Math.abs(X - 0);
		int ans_l = 0;
		
		for (int i = X -1; i >= 0 ; i--) {
			if(!p.contains(i)) {
				ans_l = i;
				cost_l = Math.abs(X - i);
				break;
			}
		}
		int cost_r = Math.abs(101 - X);
		int ans_r = 101;
		
		for (int i = X +1; i <= 101  ; i++) {
			if(!p.contains(i)) {
				ans_r = i;
				cost_r = Math.abs(X - i);
				break;
			}
		}		
		
		if(cost_l < cost_r) {
			System.out.println(ans_l);
		}
		else if(cost_l > cost_r) {
			System.out.println(ans_r);
		}
		else {
			System.out.println(ans_l);
		}
		
	}
} Main public static void main(String[] args) {

		// 読み込み
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();

		List<Integer> p = new ArrayList<>();
		
		if (N == 0) {
			System.out.println(X);
			return;
		}
		for (int i = 1; i <=N ; i++) {
			p.add(sc.nextInt());
		}
		if (!p.contains(X)) {
			System.out.println(X);
			return;
		}
		
		int cost_l = Math.abs(X - 0);
		int ans_l = 0;
		
		for (int i = X -1; i >= 0 ; i--) {
			if(!p.contains(i)) {
				ans_l = i;
				cost_l = Math.abs(X - i);
				break;
			}
		}
		int cost_r = Math.abs(101 - X);
		int ans_r = 101;
		
		for (int i = X +1; i <= 101  ; i++) {
			if(!p.contains(i)) {
				ans_r = i;
				cost_r = Math.abs(X - i);
				break;
			}
		}		
		
		if(cost_l < cost_r) {
			System.out.println(ans_l);
		}
		else if(cost_l > cost_r) {
			System.out.println(ans_r);
		}
		else {
			System.out.println(ans_l);
		}
		
	} main {

		// 読み込み
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();

		List<Integer> p = new ArrayList<>();
		
		if (N == 0) {
			System.out.println(X);
			return;
		}
		for (int i = 1; i <=N ; i++) {
			p.add(sc.nextInt());
		}
		if (!p.contains(X)) {
			System.out.println(X);
			return;
		}
		
		int cost_l = Math.abs(X - 0);
		int ans_l = 0;
		
		for (int i = X -1; i >= 0 ; i--) {
			if(!p.contains(i)) {
				ans_l = i;
				cost_l = Math.abs(X - i);
				break;
			}
		}
		int cost_r = Math.abs(101 - X);
		int ans_r = 101;
		
		for (int i = X +1; i <= 101  ; i++) {
			if(!p.contains(i)) {
				ans_r = i;
				cost_r = Math.abs(X - i);
				break;
			}
		}		
		
		if(cost_l < cost_r) {
			System.out.println(ans_l);
		}
		else if(cost_l > cost_r) {
			System.out.println(ans_r);
		}
		else {
			System.out.println(ans_l);
		}
		
	} 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> p = new ArrayList<>(); p new ArrayList<>() if (N == 0) {
			System.out.println(X);
			return;
		} N == 0 N 0 {
			System.out.println(X);
			return;
		} System.out.println(X) System.out.println System.out System System.out X return; for (int i = 1; i <=N ; i++) {
			p.add(sc.nextInt());
		} int i = 1; int i = 1; i 1 i <=N i N i++ i++ i {
			p.add(sc.nextInt());
		} {
			p.add(sc.nextInt());
		} p.add(sc.nextInt()) p.add p sc.nextInt() sc.nextInt sc if (!p.contains(X)) {
			System.out.println(X);
			return;
		} !p.contains(X) p.contains(X) p.contains p X {
			System.out.println(X);
			return;
		} System.out.println(X) System.out.println System.out System System.out X return; int cost_l = Math.abs(X - 0); cost_l Math.abs(X - 0) Math.abs Math X - 0 X 0 int ans_l = 0; ans_l 0 for (int i = X -1; i >= 0 ; i--) {
			if(!p.contains(i)) {
				ans_l = i;
				cost_l = Math.abs(X - i);
				break;
			}
		} int i = X -1; int i = X -1; i X -1 X 1 i >= 0 i 0 i-- i-- i {
			if(!p.contains(i)) {
				ans_l = i;
				cost_l = Math.abs(X - i);
				break;
			}
		} {
			if(!p.contains(i)) {
				ans_l = i;
				cost_l = Math.abs(X - i);
				break;
			}
		} if(!p.contains(i)) {
				ans_l = i;
				cost_l = Math.abs(X - i);
				break;
			} !p.contains(i) p.contains(i) p.contains p i {
				ans_l = i;
				cost_l = Math.abs(X - i);
				break;
			} ans_l = i ans_l i cost_l = Math.abs(X - i) cost_l Math.abs(X - i) Math.abs Math X - i X i break; int cost_r = Math.abs(101 - X); cost_r Math.abs(101 - X) Math.abs Math 101 - X 101 X int ans_r = 101; ans_r 101 for (int i = X +1; i <= 101  ; i++) {
			if(!p.contains(i)) {
				ans_r = i;
				cost_r = Math.abs(X - i);
				break;
			}
		} int i = X +1; int i = X +1; i X +1 X 1 i <= 101 i 101 i++ i++ i {
			if(!p.contains(i)) {
				ans_r = i;
				cost_r = Math.abs(X - i);
				break;
			}
		} {
			if(!p.contains(i)) {
				ans_r = i;
				cost_r = Math.abs(X - i);
				break;
			}
		} if(!p.contains(i)) {
				ans_r = i;
				cost_r = Math.abs(X - i);
				break;
			} !p.contains(i) p.contains(i) p.contains p i {
				ans_r = i;
				cost_r = Math.abs(X - i);
				break;
			} ans_r = i ans_r i cost_r = Math.abs(X - i) cost_r Math.abs(X - i) Math.abs Math X - i X i break; if(cost_l < cost_r) {
			System.out.println(ans_l);
		}
		else if(cost_l > cost_r) {
			System.out.println(ans_r);
		}
		else {
			System.out.println(ans_l);
		} cost_l < cost_r cost_l cost_r {
			System.out.println(ans_l);
		} System.out.println(ans_l) System.out.println System.out System System.out ans_l if(cost_l > cost_r) {
			System.out.println(ans_r);
		}
		else {
			System.out.println(ans_l);
		} cost_l > cost_r cost_l cost_r {
			System.out.println(ans_r);
		} System.out.println(ans_r) System.out.println System.out System System.out ans_r {
			System.out.println(ans_l);
		} System.out.println(ans_l) System.out.println System.out System System.out ans_l String[] args args public class Main {

	public static void main(String[] args) {

		// 読み込み
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();

		List<Integer> p = new ArrayList<>();
		
		if (N == 0) {
			System.out.println(X);
			return;
		}
		for (int i = 1; i <=N ; i++) {
			p.add(sc.nextInt());
		}
		if (!p.contains(X)) {
			System.out.println(X);
			return;
		}
		
		int cost_l = Math.abs(X - 0);
		int ans_l = 0;
		
		for (int i = X -1; i >= 0 ; i--) {
			if(!p.contains(i)) {
				ans_l = i;
				cost_l = Math.abs(X - i);
				break;
			}
		}
		int cost_r = Math.abs(101 - X);
		int ans_r = 101;
		
		for (int i = X +1; i <= 101  ; i++) {
			if(!p.contains(i)) {
				ans_r = i;
				cost_r = Math.abs(X - i);
				break;
			}
		}		
		
		if(cost_l < cost_r) {
			System.out.println(ans_l);
		}
		else if(cost_l > cost_r) {
			System.out.println(ans_r);
		}
		else {
			System.out.println(ans_l);
		}
		
	}
} public class Main {

	public static void main(String[] args) {

		// 読み込み
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();

		List<Integer> p = new ArrayList<>();
		
		if (N == 0) {
			System.out.println(X);
			return;
		}
		for (int i = 1; i <=N ; i++) {
			p.add(sc.nextInt());
		}
		if (!p.contains(X)) {
			System.out.println(X);
			return;
		}
		
		int cost_l = Math.abs(X - 0);
		int ans_l = 0;
		
		for (int i = X -1; i >= 0 ; i--) {
			if(!p.contains(i)) {
				ans_l = i;
				cost_l = Math.abs(X - i);
				break;
			}
		}
		int cost_r = Math.abs(101 - X);
		int ans_r = 101;
		
		for (int i = X +1; i <= 101  ; i++) {
			if(!p.contains(i)) {
				ans_r = i;
				cost_r = Math.abs(X - i);
				break;
			}
		}		
		
		if(cost_l < cost_r) {
			System.out.println(ans_l);
		}
		else if(cost_l > cost_r) {
			System.out.println(ans_r);
		}
		else {
			System.out.println(ans_l);
		}
		
	}
} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		// 読み込み
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();

		List<Integer> p = new ArrayList<>();
		
		if (N == 0) {
			System.out.println(X);
			return;
		}
		for (int i = 1; i <=N ; i++) {
			p.add(sc.nextInt());
		}
		if (!p.contains(X)) {
			System.out.println(X);
			return;
		}
		
		int cost_l = Math.abs(X - 0);
		int ans_l = 0;
		
		for (int i = X -1; i >= 0 ; i--) {
			if(!p.contains(i)) {
				ans_l = i;
				cost_l = Math.abs(X - i);
				break;
			}
		}
		int cost_r = Math.abs(101 - X);
		int ans_r = 101;
		
		for (int i = X +1; i <= 101  ; i++) {
			if(!p.contains(i)) {
				ans_r = i;
				cost_r = Math.abs(X - i);
				break;
			}
		}		
		
		if(cost_l < cost_r) {
			System.out.println(ans_l);
		}
		else if(cost_l > cost_r) {
			System.out.println(ans_r);
		}
		else {
			System.out.println(ans_l);
		}
		
	}
}
