import java.util.ArrayList;
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int x = scanner.nextInt();
		int length = scanner.nextInt();
		ArrayList<Integer> unwanted = new ArrayList<Integer>();
		for(int i = 0; i < length; i++) {
			unwanted.add(scanner.nextInt());
		}
		int maximum = -100;
		int difference = 0;
		while(maximum == -100) {
			if(!unwanted.contains(x - difference))
				maximum = x - difference;
			else if(!unwanted.contains(x + difference))
				maximum = x + difference;
			difference++;
		}
		System.out.print(maximum);
		
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int x = scanner.nextInt();
		int length = scanner.nextInt();
		ArrayList<Integer> unwanted = new ArrayList<Integer>();
		for(int i = 0; i < length; i++) {
			unwanted.add(scanner.nextInt());
		}
		int maximum = -100;
		int difference = 0;
		while(maximum == -100) {
			if(!unwanted.contains(x - difference))
				maximum = x - difference;
			else if(!unwanted.contains(x + difference))
				maximum = x + difference;
			difference++;
		}
		System.out.print(maximum);
		
	}
} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int x = scanner.nextInt();
		int length = scanner.nextInt();
		ArrayList<Integer> unwanted = new ArrayList<Integer>();
		for(int i = 0; i < length; i++) {
			unwanted.add(scanner.nextInt());
		}
		int maximum = -100;
		int difference = 0;
		while(maximum == -100) {
			if(!unwanted.contains(x - difference))
				maximum = x - difference;
			else if(!unwanted.contains(x + difference))
				maximum = x + difference;
			difference++;
		}
		System.out.print(maximum);
		
	} main {
		Scanner scanner = new Scanner(System.in);
		int x = scanner.nextInt();
		int length = scanner.nextInt();
		ArrayList<Integer> unwanted = new ArrayList<Integer>();
		for(int i = 0; i < length; i++) {
			unwanted.add(scanner.nextInt());
		}
		int maximum = -100;
		int difference = 0;
		while(maximum == -100) {
			if(!unwanted.contains(x - difference))
				maximum = x - difference;
			else if(!unwanted.contains(x + difference))
				maximum = x + difference;
			difference++;
		}
		System.out.print(maximum);
		
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int x = scanner.nextInt(); x scanner.nextInt() scanner.nextInt scanner int length = scanner.nextInt(); length scanner.nextInt() scanner.nextInt scanner ArrayList<Integer> unwanted = new ArrayList<Integer>(); unwanted new ArrayList<Integer>() for(int i = 0; i < length; i++) {
			unwanted.add(scanner.nextInt());
		} int i = 0; int i = 0; i 0 i < length i length i++ i++ i {
			unwanted.add(scanner.nextInt());
		} {
			unwanted.add(scanner.nextInt());
		} unwanted.add(scanner.nextInt()) unwanted.add unwanted scanner.nextInt() scanner.nextInt scanner int maximum = -100; maximum -100 100 int difference = 0; difference 0 while(maximum == -100) {
			if(!unwanted.contains(x - difference))
				maximum = x - difference;
			else if(!unwanted.contains(x + difference))
				maximum = x + difference;
			difference++;
		} maximum == -100 maximum -100 100 {
			if(!unwanted.contains(x - difference))
				maximum = x - difference;
			else if(!unwanted.contains(x + difference))
				maximum = x + difference;
			difference++;
		} if(!unwanted.contains(x - difference))
				maximum = x - difference;
			else if(!unwanted.contains(x + difference))
				maximum = x + difference; !unwanted.contains(x - difference) unwanted.contains(x - difference) unwanted.contains unwanted x - difference x difference maximum = x - difference maximum x - difference x difference if(!unwanted.contains(x + difference))
				maximum = x + difference; !unwanted.contains(x + difference) unwanted.contains(x + difference) unwanted.contains unwanted x + difference x difference maximum = x + difference maximum x + difference x difference difference++ difference System.out.print(maximum) System.out.print System.out System System.out maximum String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int x = scanner.nextInt();
		int length = scanner.nextInt();
		ArrayList<Integer> unwanted = new ArrayList<Integer>();
		for(int i = 0; i < length; i++) {
			unwanted.add(scanner.nextInt());
		}
		int maximum = -100;
		int difference = 0;
		while(maximum == -100) {
			if(!unwanted.contains(x - difference))
				maximum = x - difference;
			else if(!unwanted.contains(x + difference))
				maximum = x + difference;
			difference++;
		}
		System.out.print(maximum);
		
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int x = scanner.nextInt();
		int length = scanner.nextInt();
		ArrayList<Integer> unwanted = new ArrayList<Integer>();
		for(int i = 0; i < length; i++) {
			unwanted.add(scanner.nextInt());
		}
		int maximum = -100;
		int difference = 0;
		while(maximum == -100) {
			if(!unwanted.contains(x - difference))
				maximum = x - difference;
			else if(!unwanted.contains(x + difference))
				maximum = x + difference;
			difference++;
		}
		System.out.print(maximum);
		
	}
} Main
import java.util.ArrayList;
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int x = scanner.nextInt();
		int length = scanner.nextInt();
		ArrayList<Integer> unwanted = new ArrayList<Integer>();
		for(int i = 0; i < length; i++) {
			unwanted.add(scanner.nextInt());
		}
		int maximum = -100;
		int difference = 0;
		while(maximum == -100) {
			if(!unwanted.contains(x - difference))
				maximum = x - difference;
			else if(!unwanted.contains(x + difference))
				maximum = x + difference;
			difference++;
		}
		System.out.print(maximum);
		
	}
}