import java.util.Arrays;
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();
		int min = 0;
		int max = 101;
		Integer[] p = new Integer[N];
		for(int i=0; i<N ;i++) {
			p[i] = sc.nextInt();
		}
	if(N != 0) {
		for(int i = 1; i <=101; i++) {
			//配列内に要素が存在していなければ入る
			if(!Arrays.asList(p).contains(i)) {
				min = min<=i && i<=X? i:min;
				max = i<=max && i>=X? i:max;
			}
		}
		if(Math.abs(min-X) <= Math.abs(max-X)){
			System.out.println(min);
		}else {
			System.out.println(max);
		}

	}else {
		System.out.println(X);
	}

	}
} import java.util.Arrays; Arrays 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();
		int min = 0;
		int max = 101;
		Integer[] p = new Integer[N];
		for(int i=0; i<N ;i++) {
			p[i] = sc.nextInt();
		}
	if(N != 0) {
		for(int i = 1; i <=101; i++) {
			//配列内に要素が存在していなければ入る
			if(!Arrays.asList(p).contains(i)) {
				min = min<=i && i<=X? i:min;
				max = i<=max && i>=X? i:max;
			}
		}
		if(Math.abs(min-X) <= Math.abs(max-X)){
			System.out.println(min);
		}else {
			System.out.println(max);
		}

	}else {
		System.out.println(X);
	}

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

		Scanner sc = new Scanner(System.in);

		int X = sc.nextInt();
		int N = sc.nextInt();
		int min = 0;
		int max = 101;
		Integer[] p = new Integer[N];
		for(int i=0; i<N ;i++) {
			p[i] = sc.nextInt();
		}
	if(N != 0) {
		for(int i = 1; i <=101; i++) {
			//配列内に要素が存在していなければ入る
			if(!Arrays.asList(p).contains(i)) {
				min = min<=i && i<=X? i:min;
				max = i<=max && i>=X? i:max;
			}
		}
		if(Math.abs(min-X) <= Math.abs(max-X)){
			System.out.println(min);
		}else {
			System.out.println(max);
		}

	}else {
		System.out.println(X);
	}

	} main {

		Scanner sc = new Scanner(System.in);

		int X = sc.nextInt();
		int N = sc.nextInt();
		int min = 0;
		int max = 101;
		Integer[] p = new Integer[N];
		for(int i=0; i<N ;i++) {
			p[i] = sc.nextInt();
		}
	if(N != 0) {
		for(int i = 1; i <=101; i++) {
			//配列内に要素が存在していなければ入る
			if(!Arrays.asList(p).contains(i)) {
				min = min<=i && i<=X? i:min;
				max = i<=max && i>=X? i:max;
			}
		}
		if(Math.abs(min-X) <= Math.abs(max-X)){
			System.out.println(min);
		}else {
			System.out.println(max);
		}

	}else {
		System.out.println(X);
	}

	} 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 int min = 0; min 0 int max = 101; max 101 Integer[] p = new Integer[N]; p new Integer[N] N for(int i=0; i<N ;i++) {
			p[i] = sc.nextInt();
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			p[i] = sc.nextInt();
		} {
			p[i] = sc.nextInt();
		} p[i] = sc.nextInt() p[i] p i sc.nextInt() sc.nextInt sc if(N != 0) {
		for(int i = 1; i <=101; i++) {
			//配列内に要素が存在していなければ入る
			if(!Arrays.asList(p).contains(i)) {
				min = min<=i && i<=X? i:min;
				max = i<=max && i>=X? i:max;
			}
		}
		if(Math.abs(min-X) <= Math.abs(max-X)){
			System.out.println(min);
		}else {
			System.out.println(max);
		}

	}else {
		System.out.println(X);
	} N != 0 N 0 {
		for(int i = 1; i <=101; i++) {
			//配列内に要素が存在していなければ入る
			if(!Arrays.asList(p).contains(i)) {
				min = min<=i && i<=X? i:min;
				max = i<=max && i>=X? i:max;
			}
		}
		if(Math.abs(min-X) <= Math.abs(max-X)){
			System.out.println(min);
		}else {
			System.out.println(max);
		}

	} for(int i = 1; i <=101; i++) {
			//配列内に要素が存在していなければ入る
			if(!Arrays.asList(p).contains(i)) {
				min = min<=i && i<=X? i:min;
				max = i<=max && i>=X? i:max;
			}
		} int i = 1; int i = 1; i 1 i <=101 i 101 i++ i++ i {
			//配列内に要素が存在していなければ入る
			if(!Arrays.asList(p).contains(i)) {
				min = min<=i && i<=X? i:min;
				max = i<=max && i>=X? i:max;
			}
		} {
			//配列内に要素が存在していなければ入る
			if(!Arrays.asList(p).contains(i)) {
				min = min<=i && i<=X? i:min;
				max = i<=max && i>=X? i:max;
			}
		} if(!Arrays.asList(p).contains(i)) {
				min = min<=i && i<=X? i:min;
				max = i<=max && i>=X? i:max;
			} !Arrays.asList(p).contains(i) Arrays.asList(p).contains(i) Arrays.asList(p).contains Arrays.asList(p) Arrays.asList Arrays p i {
				min = min<=i && i<=X? i:min;
				max = i<=max && i>=X? i:max;
			} min = min<=i && i<=X? i:min min min<=i && i<=X? i:min min<=i && i<=X min<=i min i i<=X i X i min max = i<=max && i>=X? i:max max i<=max && i>=X? i:max i<=max && i>=X i<=max i max i>=X i X i max if(Math.abs(min-X) <= Math.abs(max-X)){
			System.out.println(min);
		}else {
			System.out.println(max);
		} Math.abs(min-X) <= Math.abs(max-X) Math.abs(min-X) Math.abs Math min-X min X Math.abs(max-X) Math.abs Math max-X max X {
			System.out.println(min);
		} System.out.println(min) System.out.println System.out System System.out min {
			System.out.println(max);
		} System.out.println(max) System.out.println System.out System System.out max {
		System.out.println(X);
	} System.out.println(X) System.out.println System.out System System.out X 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();
		int min = 0;
		int max = 101;
		Integer[] p = new Integer[N];
		for(int i=0; i<N ;i++) {
			p[i] = sc.nextInt();
		}
	if(N != 0) {
		for(int i = 1; i <=101; i++) {
			//配列内に要素が存在していなければ入る
			if(!Arrays.asList(p).contains(i)) {
				min = min<=i && i<=X? i:min;
				max = i<=max && i>=X? i:max;
			}
		}
		if(Math.abs(min-X) <= Math.abs(max-X)){
			System.out.println(min);
		}else {
			System.out.println(max);
		}

	}else {
		System.out.println(X);
	}

	}
} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int X = sc.nextInt();
		int N = sc.nextInt();
		int min = 0;
		int max = 101;
		Integer[] p = new Integer[N];
		for(int i=0; i<N ;i++) {
			p[i] = sc.nextInt();
		}
	if(N != 0) {
		for(int i = 1; i <=101; i++) {
			//配列内に要素が存在していなければ入る
			if(!Arrays.asList(p).contains(i)) {
				min = min<=i && i<=X? i:min;
				max = i<=max && i>=X? i:max;
			}
		}
		if(Math.abs(min-X) <= Math.abs(max-X)){
			System.out.println(min);
		}else {
			System.out.println(max);
		}

	}else {
		System.out.println(X);
	}

	}
} Main
import java.util.Arrays;
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();
		int min = 0;
		int max = 101;
		Integer[] p = new Integer[N];
		for(int i=0; i<N ;i++) {
			p[i] = sc.nextInt();
		}
	if(N != 0) {
		for(int i = 1; i <=101; i++) {
			//配列内に要素が存在していなければ入る
			if(!Arrays.asList(p).contains(i)) {
				min = min<=i && i<=X? i:min;
				max = i<=max && i>=X? i:max;
			}
		}
		if(Math.abs(min-X) <= Math.abs(max-X)){
			System.out.println(min);
		}else {
			System.out.println(max);
		}

	}else {
		System.out.println(X);
	}

	}
}
