import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int X = sc.nextInt();
		final int N = sc.nextInt();
		if(N==0){
			sc.close();
			System.out.println(X);
			return;
		}
		ArrayList<Integer> p = new ArrayList<>();
		int max=0;
		for(int i=0;i<N;++i){
			p.add(sc.nextInt());
		}
		for(int i=0;i<N;++i){
			max = Math.max(p.get(i), max);
		}
		sc.close();
		int ans = 0;
		int i=0;
		int min = 101;
		int tmp = min;
		while(i<(X+max)){
			if(p.contains(i)) {
				++i;
				continue;
			}
			min = Math.min(Math.abs(X-i), min);
			if(Math.min(tmp, min)==tmp){break;}
			ans = i;
			++i;
			tmp = min;
		}
		System.out.println(ans);
	}
} import java.util.*; util.* java class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int X = sc.nextInt();
		final int N = sc.nextInt();
		if(N==0){
			sc.close();
			System.out.println(X);
			return;
		}
		ArrayList<Integer> p = new ArrayList<>();
		int max=0;
		for(int i=0;i<N;++i){
			p.add(sc.nextInt());
		}
		for(int i=0;i<N;++i){
			max = Math.max(p.get(i), max);
		}
		sc.close();
		int ans = 0;
		int i=0;
		int min = 101;
		int tmp = min;
		while(i<(X+max)){
			if(p.contains(i)) {
				++i;
				continue;
			}
			min = Math.min(Math.abs(X-i), min);
			if(Math.min(tmp, min)==tmp){break;}
			ans = i;
			++i;
			tmp = min;
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int X = sc.nextInt();
		final int N = sc.nextInt();
		if(N==0){
			sc.close();
			System.out.println(X);
			return;
		}
		ArrayList<Integer> p = new ArrayList<>();
		int max=0;
		for(int i=0;i<N;++i){
			p.add(sc.nextInt());
		}
		for(int i=0;i<N;++i){
			max = Math.max(p.get(i), max);
		}
		sc.close();
		int ans = 0;
		int i=0;
		int min = 101;
		int tmp = min;
		while(i<(X+max)){
			if(p.contains(i)) {
				++i;
				continue;
			}
			min = Math.min(Math.abs(X-i), min);
			if(Math.min(tmp, min)==tmp){break;}
			ans = i;
			++i;
			tmp = min;
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		final int X = sc.nextInt();
		final int N = sc.nextInt();
		if(N==0){
			sc.close();
			System.out.println(X);
			return;
		}
		ArrayList<Integer> p = new ArrayList<>();
		int max=0;
		for(int i=0;i<N;++i){
			p.add(sc.nextInt());
		}
		for(int i=0;i<N;++i){
			max = Math.max(p.get(i), max);
		}
		sc.close();
		int ans = 0;
		int i=0;
		int min = 101;
		int tmp = min;
		while(i<(X+max)){
			if(p.contains(i)) {
				++i;
				continue;
			}
			min = Math.min(Math.abs(X-i), min);
			if(Math.min(tmp, min)==tmp){break;}
			ans = i;
			++i;
			tmp = min;
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) final int X = sc.nextInt(); X sc.nextInt() sc.nextInt sc final int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc if(N==0){
			sc.close();
			System.out.println(X);
			return;
		} N==0 N 0 {
			sc.close();
			System.out.println(X);
			return;
		} sc.close() sc.close sc System.out.println(X) System.out.println System.out System System.out X return; ArrayList<Integer> p = new ArrayList<>(); p new ArrayList<>() int max=0; max 0 for(int i=0;i<N;++i){
			p.add(sc.nextInt());
		} int i=0; int i=0; i 0 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 for(int i=0;i<N;++i){
			max = Math.max(p.get(i), max);
		} int i=0; int i=0; i 0 i<N i N ++i ++i i {
			max = Math.max(p.get(i), max);
		} {
			max = Math.max(p.get(i), max);
		} max = Math.max(p.get(i), max) max Math.max(p.get(i), max) Math.max Math p.get(i) p.get p i max sc.close() sc.close sc int ans = 0; ans 0 int i=0; i 0 int min = 101; min 101 int tmp = min; tmp min while(i<(X+max)){
			if(p.contains(i)) {
				++i;
				continue;
			}
			min = Math.min(Math.abs(X-i), min);
			if(Math.min(tmp, min)==tmp){break;}
			ans = i;
			++i;
			tmp = min;
		} i<(X+max) i (X+max) X max {
			if(p.contains(i)) {
				++i;
				continue;
			}
			min = Math.min(Math.abs(X-i), min);
			if(Math.min(tmp, min)==tmp){break;}
			ans = i;
			++i;
			tmp = min;
		} if(p.contains(i)) {
				++i;
				continue;
			} p.contains(i) p.contains p i {
				++i;
				continue;
			} ++i i continue; min = Math.min(Math.abs(X-i), min) min Math.min(Math.abs(X-i), min) Math.min Math Math.abs(X-i) Math.abs Math X-i X i min if(Math.min(tmp, min)==tmp){break;} Math.min(tmp, min)==tmp Math.min(tmp, min) Math.min Math tmp min tmp {break;} break; ans = i ans i ++i i tmp = min tmp min System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int X = sc.nextInt();
		final int N = sc.nextInt();
		if(N==0){
			sc.close();
			System.out.println(X);
			return;
		}
		ArrayList<Integer> p = new ArrayList<>();
		int max=0;
		for(int i=0;i<N;++i){
			p.add(sc.nextInt());
		}
		for(int i=0;i<N;++i){
			max = Math.max(p.get(i), max);
		}
		sc.close();
		int ans = 0;
		int i=0;
		int min = 101;
		int tmp = min;
		while(i<(X+max)){
			if(p.contains(i)) {
				++i;
				continue;
			}
			min = Math.min(Math.abs(X-i), min);
			if(Math.min(tmp, min)==tmp){break;}
			ans = i;
			++i;
			tmp = min;
		}
		System.out.println(ans);
	}
}
