
import java.util.*;

class Main {


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();
		
		ArrayList<Integer> list = new ArrayList<Integer>();
		for(int i=0; i<N; i++) {
			list.add(sc.nextInt());
		}
		int d = 0;
		while(true) {
			if(!list.contains(X-d)) {
				System.out.println(X-d);
				break;
			}
			if(!list.contains(X+d)) {
				System.out.println(X+d);
				break;
			}
			d ++;
		}
		
		
	}

}

 import java.util.*; util.* java class Main {


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();
		
		ArrayList<Integer> list = new ArrayList<Integer>();
		for(int i=0; i<N; i++) {
			list.add(sc.nextInt());
		}
		int d = 0;
		while(true) {
			if(!list.contains(X-d)) {
				System.out.println(X-d);
				break;
			}
			if(!list.contains(X+d)) {
				System.out.println(X+d);
				break;
			}
			d ++;
		}
		
		
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();
		
		ArrayList<Integer> list = new ArrayList<Integer>();
		for(int i=0; i<N; i++) {
			list.add(sc.nextInt());
		}
		int d = 0;
		while(true) {
			if(!list.contains(X-d)) {
				System.out.println(X-d);
				break;
			}
			if(!list.contains(X+d)) {
				System.out.println(X+d);
				break;
			}
			d ++;
		}
		
		
	} main {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();
		
		ArrayList<Integer> list = new ArrayList<Integer>();
		for(int i=0; i<N; i++) {
			list.add(sc.nextInt());
		}
		int d = 0;
		while(true) {
			if(!list.contains(X-d)) {
				System.out.println(X-d);
				break;
			}
			if(!list.contains(X+d)) {
				System.out.println(X+d);
				break;
			}
			d ++;
		}
		
		
	} 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 ArrayList<Integer> list = new ArrayList<Integer>(); list new ArrayList<Integer>() for(int i=0; i<N; i++) {
			list.add(sc.nextInt());
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			list.add(sc.nextInt());
		} {
			list.add(sc.nextInt());
		} list.add(sc.nextInt()) list.add list sc.nextInt() sc.nextInt sc int d = 0; d 0 while(true) {
			if(!list.contains(X-d)) {
				System.out.println(X-d);
				break;
			}
			if(!list.contains(X+d)) {
				System.out.println(X+d);
				break;
			}
			d ++;
		} true {
			if(!list.contains(X-d)) {
				System.out.println(X-d);
				break;
			}
			if(!list.contains(X+d)) {
				System.out.println(X+d);
				break;
			}
			d ++;
		} if(!list.contains(X-d)) {
				System.out.println(X-d);
				break;
			} !list.contains(X-d) list.contains(X-d) list.contains list X-d X d {
				System.out.println(X-d);
				break;
			} System.out.println(X-d) System.out.println System.out System System.out X-d X d break; if(!list.contains(X+d)) {
				System.out.println(X+d);
				break;
			} !list.contains(X+d) list.contains(X+d) list.contains list X+d X d {
				System.out.println(X+d);
				break;
			} System.out.println(X+d) System.out.println System.out System System.out X+d X d break; d ++ d String[] args args

import java.util.*;

class Main {


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();
		
		ArrayList<Integer> list = new ArrayList<Integer>();
		for(int i=0; i<N; i++) {
			list.add(sc.nextInt());
		}
		int d = 0;
		while(true) {
			if(!list.contains(X-d)) {
				System.out.println(X-d);
				break;
			}
			if(!list.contains(X+d)) {
				System.out.println(X+d);
				break;
			}
			d ++;
		}
		
		
	}

}


