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();
		String[] nums = new String[n];
		for (int i = 0; i < n; i++){
			nums[i] = sc.next();
		}
		sc.close();
		for(int count = 0;;count++){
			if (!(Arrays.asList(nums).contains(String.valueOf(x-count)))){
				System.out.println(x-count);
				break;
			}
			if (!(Arrays.asList(nums).contains(String.valueOf(x+count)))){
				System.out.println(x+count);
				break;
			}
		}
	}
} 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();
		String[] nums = new String[n];
		for (int i = 0; i < n; i++){
			nums[i] = sc.next();
		}
		sc.close();
		for(int count = 0;;count++){
			if (!(Arrays.asList(nums).contains(String.valueOf(x-count)))){
				System.out.println(x-count);
				break;
			}
			if (!(Arrays.asList(nums).contains(String.valueOf(x+count)))){
				System.out.println(x+count);
				break;
			}
		}
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		String[] nums = new String[n];
		for (int i = 0; i < n; i++){
			nums[i] = sc.next();
		}
		sc.close();
		for(int count = 0;;count++){
			if (!(Arrays.asList(nums).contains(String.valueOf(x-count)))){
				System.out.println(x-count);
				break;
			}
			if (!(Arrays.asList(nums).contains(String.valueOf(x+count)))){
				System.out.println(x+count);
				break;
			}
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		String[] nums = new String[n];
		for (int i = 0; i < n; i++){
			nums[i] = sc.next();
		}
		sc.close();
		for(int count = 0;;count++){
			if (!(Arrays.asList(nums).contains(String.valueOf(x-count)))){
				System.out.println(x-count);
				break;
			}
			if (!(Arrays.asList(nums).contains(String.valueOf(x+count)))){
				System.out.println(x+count);
				break;
			}
		}
	} 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 String[] nums = new String[n]; nums new String[n] n for (int i = 0; i < n; i++){
			nums[i] = sc.next();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			nums[i] = sc.next();
		} {
			nums[i] = sc.next();
		} nums[i] = sc.next() nums[i] nums i sc.next() sc.next sc sc.close() sc.close sc for(int count = 0;;count++){
			if (!(Arrays.asList(nums).contains(String.valueOf(x-count)))){
				System.out.println(x-count);
				break;
			}
			if (!(Arrays.asList(nums).contains(String.valueOf(x+count)))){
				System.out.println(x+count);
				break;
			}
		} int count = 0; int count = 0; count 0 count++ count++ count {
			if (!(Arrays.asList(nums).contains(String.valueOf(x-count)))){
				System.out.println(x-count);
				break;
			}
			if (!(Arrays.asList(nums).contains(String.valueOf(x+count)))){
				System.out.println(x+count);
				break;
			}
		} {
			if (!(Arrays.asList(nums).contains(String.valueOf(x-count)))){
				System.out.println(x-count);
				break;
			}
			if (!(Arrays.asList(nums).contains(String.valueOf(x+count)))){
				System.out.println(x+count);
				break;
			}
		} if (!(Arrays.asList(nums).contains(String.valueOf(x-count)))){
				System.out.println(x-count);
				break;
			} !(Arrays.asList(nums).contains(String.valueOf(x-count))) (Arrays.asList(nums).contains(String.valueOf(x-count))) Arrays.asList(nums).contains Arrays.asList(nums) Arrays.asList Arrays nums String.valueOf(x-count) String.valueOf String x-count x count {
				System.out.println(x-count);
				break;
			} System.out.println(x-count) System.out.println System.out System System.out x-count x count break; if (!(Arrays.asList(nums).contains(String.valueOf(x+count)))){
				System.out.println(x+count);
				break;
			} !(Arrays.asList(nums).contains(String.valueOf(x+count))) (Arrays.asList(nums).contains(String.valueOf(x+count))) Arrays.asList(nums).contains Arrays.asList(nums) Arrays.asList Arrays nums String.valueOf(x+count) String.valueOf String x+count x count {
				System.out.println(x+count);
				break;
			} System.out.println(x+count) System.out.println System.out System System.out x+count x count break; 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();
		String[] nums = new String[n];
		for (int i = 0; i < n; i++){
			nums[i] = sc.next();
		}
		sc.close();
		for(int count = 0;;count++){
			if (!(Arrays.asList(nums).contains(String.valueOf(x-count)))){
				System.out.println(x-count);
				break;
			}
			if (!(Arrays.asList(nums).contains(String.valueOf(x+count)))){
				System.out.println(x+count);
				break;
			}
		}
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		String[] nums = new String[n];
		for (int i = 0; i < n; i++){
			nums[i] = sc.next();
		}
		sc.close();
		for(int count = 0;;count++){
			if (!(Arrays.asList(nums).contains(String.valueOf(x-count)))){
				System.out.println(x-count);
				break;
			}
			if (!(Arrays.asList(nums).contains(String.valueOf(x+count)))){
				System.out.println(x+count);
				break;
			}
		}
	}
} 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();
		String[] nums = new String[n];
		for (int i = 0; i < n; i++){
			nums[i] = sc.next();
		}
		sc.close();
		for(int count = 0;;count++){
			if (!(Arrays.asList(nums).contains(String.valueOf(x-count)))){
				System.out.println(x-count);
				break;
			}
			if (!(Arrays.asList(nums).contains(String.valueOf(x+count)))){
				System.out.println(x+count);
				break;
			}
		}
	}
}
