import 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 ans = 0;
		Set<Integer> dict = new HashSet<>();
		for (int i = 0; i < n; i++) {
			dict.add(sc.nextInt());
		}
		int diff = 0;
		while (true) {
			int a = x - diff;
			if (!dict.contains(a)) {
				ans = a;
				break;
			}
			a = x + diff;
			if (!dict.contains(a)) {
				ans = a;
				break;
			}
			diff++;
		}
		System.out.println(ans);
	}
}





 import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		int ans = 0;
		Set<Integer> dict = new HashSet<>();
		for (int i = 0; i < n; i++) {
			dict.add(sc.nextInt());
		}
		int diff = 0;
		while (true) {
			int a = x - diff;
			if (!dict.contains(a)) {
				ans = a;
				break;
			}
			a = x + diff;
			if (!dict.contains(a)) {
				ans = a;
				break;
			}
			diff++;
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		int ans = 0;
		Set<Integer> dict = new HashSet<>();
		for (int i = 0; i < n; i++) {
			dict.add(sc.nextInt());
		}
		int diff = 0;
		while (true) {
			int a = x - diff;
			if (!dict.contains(a)) {
				ans = a;
				break;
			}
			a = x + diff;
			if (!dict.contains(a)) {
				ans = a;
				break;
			}
			diff++;
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		int ans = 0;
		Set<Integer> dict = new HashSet<>();
		for (int i = 0; i < n; i++) {
			dict.add(sc.nextInt());
		}
		int diff = 0;
		while (true) {
			int a = x - diff;
			if (!dict.contains(a)) {
				ans = a;
				break;
			}
			a = x + diff;
			if (!dict.contains(a)) {
				ans = a;
				break;
			}
			diff++;
		}
		System.out.println(ans);
	} 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 ans = 0; ans 0 Set<Integer> dict = new HashSet<>(); dict new HashSet<>() for (int i = 0; i < n; i++) {
			dict.add(sc.nextInt());
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			dict.add(sc.nextInt());
		} {
			dict.add(sc.nextInt());
		} dict.add(sc.nextInt()) dict.add dict sc.nextInt() sc.nextInt sc int diff = 0; diff 0 while (true) {
			int a = x - diff;
			if (!dict.contains(a)) {
				ans = a;
				break;
			}
			a = x + diff;
			if (!dict.contains(a)) {
				ans = a;
				break;
			}
			diff++;
		} true {
			int a = x - diff;
			if (!dict.contains(a)) {
				ans = a;
				break;
			}
			a = x + diff;
			if (!dict.contains(a)) {
				ans = a;
				break;
			}
			diff++;
		} int a = x - diff; a x - diff x diff if (!dict.contains(a)) {
				ans = a;
				break;
			} !dict.contains(a) dict.contains(a) dict.contains dict a {
				ans = a;
				break;
			} ans = a ans a break; a = x + diff a x + diff x diff if (!dict.contains(a)) {
				ans = a;
				break;
			} !dict.contains(a) dict.contains(a) dict.contains dict a {
				ans = a;
				break;
			} ans = a ans a break; diff++ diff System.out.println(ans) System.out.println System.out System System.out ans 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 ans = 0;
		Set<Integer> dict = new HashSet<>();
		for (int i = 0; i < n; i++) {
			dict.add(sc.nextInt());
		}
		int diff = 0;
		while (true) {
			int a = x - diff;
			if (!dict.contains(a)) {
				ans = a;
				break;
			}
			a = x + diff;
			if (!dict.contains(a)) {
				ans = a;
				break;
			}
			diff++;
		}
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		int ans = 0;
		Set<Integer> dict = new HashSet<>();
		for (int i = 0; i < n; i++) {
			dict.add(sc.nextInt());
		}
		int diff = 0;
		while (true) {
			int a = x - diff;
			if (!dict.contains(a)) {
				ans = a;
				break;
			}
			a = x + diff;
			if (!dict.contains(a)) {
				ans = a;
				break;
			}
			diff++;
		}
		System.out.println(ans);
	}
} Main
import 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 ans = 0;
		Set<Integer> dict = new HashSet<>();
		for (int i = 0; i < n; i++) {
			dict.add(sc.nextInt());
		}
		int diff = 0;
		while (true) {
			int a = x - diff;
			if (!dict.contains(a)) {
				ans = a;
				break;
			}
			a = x + diff;
			if (!dict.contains(a)) {
				ans = a;
				break;
			}
			diff++;
		}
		System.out.println(ans);
	}
}






