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

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = Integer.parseInt(sc.next());
		int N = Integer.parseInt(sc.next());
		List<Integer> list = new ArrayList();
		for(int i=1; i<=N; i++) {
			list.add(Integer.parseInt(sc.next()));
		}
		Collections.sort(list);

		int n1 = Integer.MAX_VALUE;
		int n2 = Integer.MAX_VALUE;
		for(int i=X; i<=101; i++) {
			if(!list.contains(i)) {
				n1=i;
				break;
			}
		}
		for(int i=X;i >=0;i--) {
			if(!list.contains(i)) {
				n2=i;
				break;
			}
		}
		System.out.println(Math.abs(X-n2)<= Math.abs(n1-X)? n2:n1);
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = Integer.parseInt(sc.next());
		int N = Integer.parseInt(sc.next());
		List<Integer> list = new ArrayList();
		for(int i=1; i<=N; i++) {
			list.add(Integer.parseInt(sc.next()));
		}
		Collections.sort(list);

		int n1 = Integer.MAX_VALUE;
		int n2 = Integer.MAX_VALUE;
		for(int i=X; i<=101; i++) {
			if(!list.contains(i)) {
				n1=i;
				break;
			}
		}
		for(int i=X;i >=0;i--) {
			if(!list.contains(i)) {
				n2=i;
				break;
			}
		}
		System.out.println(Math.abs(X-n2)<= Math.abs(n1-X)? n2:n1);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = Integer.parseInt(sc.next());
		int N = Integer.parseInt(sc.next());
		List<Integer> list = new ArrayList();
		for(int i=1; i<=N; i++) {
			list.add(Integer.parseInt(sc.next()));
		}
		Collections.sort(list);

		int n1 = Integer.MAX_VALUE;
		int n2 = Integer.MAX_VALUE;
		for(int i=X; i<=101; i++) {
			if(!list.contains(i)) {
				n1=i;
				break;
			}
		}
		for(int i=X;i >=0;i--) {
			if(!list.contains(i)) {
				n2=i;
				break;
			}
		}
		System.out.println(Math.abs(X-n2)<= Math.abs(n1-X)? n2:n1);
	} main {
		Scanner sc = new Scanner(System.in);
		int X = Integer.parseInt(sc.next());
		int N = Integer.parseInt(sc.next());
		List<Integer> list = new ArrayList();
		for(int i=1; i<=N; i++) {
			list.add(Integer.parseInt(sc.next()));
		}
		Collections.sort(list);

		int n1 = Integer.MAX_VALUE;
		int n2 = Integer.MAX_VALUE;
		for(int i=X; i<=101; i++) {
			if(!list.contains(i)) {
				n1=i;
				break;
			}
		}
		for(int i=X;i >=0;i--) {
			if(!list.contains(i)) {
				n2=i;
				break;
			}
		}
		System.out.println(Math.abs(X-n2)<= Math.abs(n1-X)? n2:n1);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int X = Integer.parseInt(sc.next()); X Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int N = Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc List<Integer> list = new ArrayList(); list new ArrayList() for(int i=1; i<=N; i++) {
			list.add(Integer.parseInt(sc.next()));
		} int i=1; int i=1; i 1 i<=N i N i++ i++ i {
			list.add(Integer.parseInt(sc.next()));
		} {
			list.add(Integer.parseInt(sc.next()));
		} list.add(Integer.parseInt(sc.next())) list.add list Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc Collections.sort(list) Collections.sort Collections list int n1 = Integer.MAX_VALUE; n1 Integer.MAX_VALUE Integer Integer.MAX_VALUE int n2 = Integer.MAX_VALUE; n2 Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i=X; i<=101; i++) {
			if(!list.contains(i)) {
				n1=i;
				break;
			}
		} int i=X; int i=X; i X i<=101 i 101 i++ i++ i {
			if(!list.contains(i)) {
				n1=i;
				break;
			}
		} {
			if(!list.contains(i)) {
				n1=i;
				break;
			}
		} if(!list.contains(i)) {
				n1=i;
				break;
			} !list.contains(i) list.contains(i) list.contains list i {
				n1=i;
				break;
			} n1=i n1 i break; for(int i=X;i >=0;i--) {
			if(!list.contains(i)) {
				n2=i;
				break;
			}
		} int i=X; int i=X; i X i >=0 i 0 i-- i-- i {
			if(!list.contains(i)) {
				n2=i;
				break;
			}
		} {
			if(!list.contains(i)) {
				n2=i;
				break;
			}
		} if(!list.contains(i)) {
				n2=i;
				break;
			} !list.contains(i) list.contains(i) list.contains list i {
				n2=i;
				break;
			} n2=i n2 i break; System.out.println(Math.abs(X-n2)<= Math.abs(n1-X)? n2:n1) System.out.println System.out System System.out Math.abs(X-n2)<= Math.abs(n1-X)? n2:n1 Math.abs(X-n2)<= Math.abs(n1-X) Math.abs(X-n2) Math.abs Math X-n2 X n2 Math.abs(n1-X) Math.abs Math n1-X n1 X n2 n1 String[] args args
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = Integer.parseInt(sc.next());
		int N = Integer.parseInt(sc.next());
		List<Integer> list = new ArrayList();
		for(int i=1; i<=N; i++) {
			list.add(Integer.parseInt(sc.next()));
		}
		Collections.sort(list);

		int n1 = Integer.MAX_VALUE;
		int n2 = Integer.MAX_VALUE;
		for(int i=X; i<=101; i++) {
			if(!list.contains(i)) {
				n1=i;
				break;
			}
		}
		for(int i=X;i >=0;i--) {
			if(!list.contains(i)) {
				n2=i;
				break;
			}
		}
		System.out.println(Math.abs(X-n2)<= Math.abs(n1-X)? n2:n1);
	}
}
