import java.util.HashSet;
import java.util.Scanner;

public class Main {
	

	
	
	
	public static void main(String[] args) {
		
		Scanner s = new Scanner(System.in);
		int x = s.nextInt();
		int n = s.nextInt();
		
		HashSet<Integer> h = new HashSet<>();
		while(n--!=0) {
			h.add(s.nextInt());
		}
		
		int t=0;
		while(h.contains(x-t) && h.contains(x+t)) {
			t++;
		}
		
		if(!h.contains(x-t)) {
			System.out.println(x-t);
		}
		else if(!h.contains(x+t)) {
			System.out.println(x+t);
		}
	}
} import java.util.HashSet; HashSet java.util import java.util.Scanner; Scanner java.util public class Main {
	

	
	
	
	public static void main(String[] args) {
		
		Scanner s = new Scanner(System.in);
		int x = s.nextInt();
		int n = s.nextInt();
		
		HashSet<Integer> h = new HashSet<>();
		while(n--!=0) {
			h.add(s.nextInt());
		}
		
		int t=0;
		while(h.contains(x-t) && h.contains(x+t)) {
			t++;
		}
		
		if(!h.contains(x-t)) {
			System.out.println(x-t);
		}
		else if(!h.contains(x+t)) {
			System.out.println(x+t);
		}
	}
} Main public static void main(String[] args) {
		
		Scanner s = new Scanner(System.in);
		int x = s.nextInt();
		int n = s.nextInt();
		
		HashSet<Integer> h = new HashSet<>();
		while(n--!=0) {
			h.add(s.nextInt());
		}
		
		int t=0;
		while(h.contains(x-t) && h.contains(x+t)) {
			t++;
		}
		
		if(!h.contains(x-t)) {
			System.out.println(x-t);
		}
		else if(!h.contains(x+t)) {
			System.out.println(x+t);
		}
	} main {
		
		Scanner s = new Scanner(System.in);
		int x = s.nextInt();
		int n = s.nextInt();
		
		HashSet<Integer> h = new HashSet<>();
		while(n--!=0) {
			h.add(s.nextInt());
		}
		
		int t=0;
		while(h.contains(x-t) && h.contains(x+t)) {
			t++;
		}
		
		if(!h.contains(x-t)) {
			System.out.println(x-t);
		}
		else if(!h.contains(x+t)) {
			System.out.println(x+t);
		}
	} Scanner s = new Scanner(System.in); s new Scanner(System.in) int x = s.nextInt(); x s.nextInt() s.nextInt s int n = s.nextInt(); n s.nextInt() s.nextInt s HashSet<Integer> h = new HashSet<>(); h new HashSet<>() while(n--!=0) {
			h.add(s.nextInt());
		} n--!=0 n-- n 0 {
			h.add(s.nextInt());
		} h.add(s.nextInt()) h.add h s.nextInt() s.nextInt s int t=0; t 0 while(h.contains(x-t) && h.contains(x+t)) {
			t++;
		} h.contains(x-t) && h.contains(x+t) h.contains(x-t) h.contains h x-t x t h.contains(x+t) h.contains h x+t x t {
			t++;
		} t++ t if(!h.contains(x-t)) {
			System.out.println(x-t);
		}
		else if(!h.contains(x+t)) {
			System.out.println(x+t);
		} !h.contains(x-t) h.contains(x-t) h.contains h x-t x t {
			System.out.println(x-t);
		} System.out.println(x-t) System.out.println System.out System System.out x-t x t if(!h.contains(x+t)) {
			System.out.println(x+t);
		} !h.contains(x+t) h.contains(x+t) h.contains h x+t x t {
			System.out.println(x+t);
		} System.out.println(x+t) System.out.println System.out System System.out x+t x t String[] args args public class Main {
	

	
	
	
	public static void main(String[] args) {
		
		Scanner s = new Scanner(System.in);
		int x = s.nextInt();
		int n = s.nextInt();
		
		HashSet<Integer> h = new HashSet<>();
		while(n--!=0) {
			h.add(s.nextInt());
		}
		
		int t=0;
		while(h.contains(x-t) && h.contains(x+t)) {
			t++;
		}
		
		if(!h.contains(x-t)) {
			System.out.println(x-t);
		}
		else if(!h.contains(x+t)) {
			System.out.println(x+t);
		}
	}
} public class Main {
	

	
	
	
	public static void main(String[] args) {
		
		Scanner s = new Scanner(System.in);
		int x = s.nextInt();
		int n = s.nextInt();
		
		HashSet<Integer> h = new HashSet<>();
		while(n--!=0) {
			h.add(s.nextInt());
		}
		
		int t=0;
		while(h.contains(x-t) && h.contains(x+t)) {
			t++;
		}
		
		if(!h.contains(x-t)) {
			System.out.println(x-t);
		}
		else if(!h.contains(x+t)) {
			System.out.println(x+t);
		}
	}
} Main
import java.util.HashSet;
import java.util.Scanner;

public class Main {
	

	
	
	
	public static void main(String[] args) {
		
		Scanner s = new Scanner(System.in);
		int x = s.nextInt();
		int n = s.nextInt();
		
		HashSet<Integer> h = new HashSet<>();
		while(n--!=0) {
			h.add(s.nextInt());
		}
		
		int t=0;
		while(h.contains(x-t) && h.contains(x+t)) {
			t++;
		}
		
		if(!h.contains(x-t)) {
			System.out.println(x-t);
		}
		else if(!h.contains(x+t)) {
			System.out.println(x+t);
		}
	}
}