import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;

public class Main {
	public static void main (String[] args) throws IOException{
	    InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
	    BufferedReader in = new BufferedReader(reader);
	    String[] str1 = in.readLine().split(" ");
	    int num1 = Integer.parseInt(str1[0]);
	    int num2 = Integer.parseInt(str1[1]);

	    if(num2==0) {
			System.out.println(num1);
	    }else {
		    String[] str2 =in.readLine().split(" ");
		    List<Integer> arrays = new ArrayList<Integer>();
		    for(int i = 0; i<num2; i++) {
		    	arrays.add(Integer.parseInt(str2[i]));
		    }
			if(!arrays.contains(num1)) {
				System.out.println(num1);
			}else {
				for(int i=1; i<num2+1; i++) {
					if(num1>0) {
					}
					if(!arrays.contains(num1-i)) {
						System.out.println(num1-i);
						break;
					}else if(!arrays.contains(num1+i)) {
						System.out.println(num1+i);
						break;
					}
				}
			}
	    }
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.nio.charset.StandardCharsets; StandardCharsets java.nio.charset import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util public class Main {
	public static void main (String[] args) throws IOException{
	    InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
	    BufferedReader in = new BufferedReader(reader);
	    String[] str1 = in.readLine().split(" ");
	    int num1 = Integer.parseInt(str1[0]);
	    int num2 = Integer.parseInt(str1[1]);

	    if(num2==0) {
			System.out.println(num1);
	    }else {
		    String[] str2 =in.readLine().split(" ");
		    List<Integer> arrays = new ArrayList<Integer>();
		    for(int i = 0; i<num2; i++) {
		    	arrays.add(Integer.parseInt(str2[i]));
		    }
			if(!arrays.contains(num1)) {
				System.out.println(num1);
			}else {
				for(int i=1; i<num2+1; i++) {
					if(num1>0) {
					}
					if(!arrays.contains(num1-i)) {
						System.out.println(num1-i);
						break;
					}else if(!arrays.contains(num1+i)) {
						System.out.println(num1+i);
						break;
					}
				}
			}
	    }
	}
} Main public static void main (String[] args) throws IOException{
	    InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
	    BufferedReader in = new BufferedReader(reader);
	    String[] str1 = in.readLine().split(" ");
	    int num1 = Integer.parseInt(str1[0]);
	    int num2 = Integer.parseInt(str1[1]);

	    if(num2==0) {
			System.out.println(num1);
	    }else {
		    String[] str2 =in.readLine().split(" ");
		    List<Integer> arrays = new ArrayList<Integer>();
		    for(int i = 0; i<num2; i++) {
		    	arrays.add(Integer.parseInt(str2[i]));
		    }
			if(!arrays.contains(num1)) {
				System.out.println(num1);
			}else {
				for(int i=1; i<num2+1; i++) {
					if(num1>0) {
					}
					if(!arrays.contains(num1-i)) {
						System.out.println(num1-i);
						break;
					}else if(!arrays.contains(num1+i)) {
						System.out.println(num1+i);
						break;
					}
				}
			}
	    }
	} main {
	    InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
	    BufferedReader in = new BufferedReader(reader);
	    String[] str1 = in.readLine().split(" ");
	    int num1 = Integer.parseInt(str1[0]);
	    int num2 = Integer.parseInt(str1[1]);

	    if(num2==0) {
			System.out.println(num1);
	    }else {
		    String[] str2 =in.readLine().split(" ");
		    List<Integer> arrays = new ArrayList<Integer>();
		    for(int i = 0; i<num2; i++) {
		    	arrays.add(Integer.parseInt(str2[i]));
		    }
			if(!arrays.contains(num1)) {
				System.out.println(num1);
			}else {
				for(int i=1; i<num2+1; i++) {
					if(num1>0) {
					}
					if(!arrays.contains(num1-i)) {
						System.out.println(num1-i);
						break;
					}else if(!arrays.contains(num1+i)) {
						System.out.println(num1+i);
						break;
					}
				}
			}
	    }
	} InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8); reader new InputStreamReader(System.in, StandardCharsets.UTF_8) BufferedReader in = new BufferedReader(reader); in new BufferedReader(reader) String[] str1 = in.readLine().split(" "); str1 in.readLine().split(" ") in.readLine().split in.readLine() in.readLine in " " int num1 = Integer.parseInt(str1[0]); num1 Integer.parseInt(str1[0]) Integer.parseInt Integer str1[0] str1 0 int num2 = Integer.parseInt(str1[1]); num2 Integer.parseInt(str1[1]) Integer.parseInt Integer str1[1] str1 1 if(num2==0) {
			System.out.println(num1);
	    }else {
		    String[] str2 =in.readLine().split(" ");
		    List<Integer> arrays = new ArrayList<Integer>();
		    for(int i = 0; i<num2; i++) {
		    	arrays.add(Integer.parseInt(str2[i]));
		    }
			if(!arrays.contains(num1)) {
				System.out.println(num1);
			}else {
				for(int i=1; i<num2+1; i++) {
					if(num1>0) {
					}
					if(!arrays.contains(num1-i)) {
						System.out.println(num1-i);
						break;
					}else if(!arrays.contains(num1+i)) {
						System.out.println(num1+i);
						break;
					}
				}
			}
	    } num2==0 num2 0 {
			System.out.println(num1);
	    } System.out.println(num1) System.out.println System.out System System.out num1 {
		    String[] str2 =in.readLine().split(" ");
		    List<Integer> arrays = new ArrayList<Integer>();
		    for(int i = 0; i<num2; i++) {
		    	arrays.add(Integer.parseInt(str2[i]));
		    }
			if(!arrays.contains(num1)) {
				System.out.println(num1);
			}else {
				for(int i=1; i<num2+1; i++) {
					if(num1>0) {
					}
					if(!arrays.contains(num1-i)) {
						System.out.println(num1-i);
						break;
					}else if(!arrays.contains(num1+i)) {
						System.out.println(num1+i);
						break;
					}
				}
			}
	    } String[] str2 =in.readLine().split(" "); str2 in.readLine().split(" ") in.readLine().split in.readLine() in.readLine in " " List<Integer> arrays = new ArrayList<Integer>(); arrays new ArrayList<Integer>() for(int i = 0; i<num2; i++) {
		    	arrays.add(Integer.parseInt(str2[i]));
		    } int i = 0; int i = 0; i 0 i<num2 i num2 i++ i++ i {
		    	arrays.add(Integer.parseInt(str2[i]));
		    } {
		    	arrays.add(Integer.parseInt(str2[i]));
		    } arrays.add(Integer.parseInt(str2[i])) arrays.add arrays Integer.parseInt(str2[i]) Integer.parseInt Integer str2[i] str2 i if(!arrays.contains(num1)) {
				System.out.println(num1);
			}else {
				for(int i=1; i<num2+1; i++) {
					if(num1>0) {
					}
					if(!arrays.contains(num1-i)) {
						System.out.println(num1-i);
						break;
					}else if(!arrays.contains(num1+i)) {
						System.out.println(num1+i);
						break;
					}
				}
			} !arrays.contains(num1) arrays.contains(num1) arrays.contains arrays num1 {
				System.out.println(num1);
			} System.out.println(num1) System.out.println System.out System System.out num1 {
				for(int i=1; i<num2+1; i++) {
					if(num1>0) {
					}
					if(!arrays.contains(num1-i)) {
						System.out.println(num1-i);
						break;
					}else if(!arrays.contains(num1+i)) {
						System.out.println(num1+i);
						break;
					}
				}
			} for(int i=1; i<num2+1; i++) {
					if(num1>0) {
					}
					if(!arrays.contains(num1-i)) {
						System.out.println(num1-i);
						break;
					}else if(!arrays.contains(num1+i)) {
						System.out.println(num1+i);
						break;
					}
				} int i=1; int i=1; i 1 i<num2+1 i num2+1 num2 1 i++ i++ i {
					if(num1>0) {
					}
					if(!arrays.contains(num1-i)) {
						System.out.println(num1-i);
						break;
					}else if(!arrays.contains(num1+i)) {
						System.out.println(num1+i);
						break;
					}
				} {
					if(num1>0) {
					}
					if(!arrays.contains(num1-i)) {
						System.out.println(num1-i);
						break;
					}else if(!arrays.contains(num1+i)) {
						System.out.println(num1+i);
						break;
					}
				} if(num1>0) {
					} num1>0 num1 0 {
					} if(!arrays.contains(num1-i)) {
						System.out.println(num1-i);
						break;
					}else if(!arrays.contains(num1+i)) {
						System.out.println(num1+i);
						break;
					} !arrays.contains(num1-i) arrays.contains(num1-i) arrays.contains arrays num1-i num1 i {
						System.out.println(num1-i);
						break;
					} System.out.println(num1-i) System.out.println System.out System System.out num1-i num1 i break; if(!arrays.contains(num1+i)) {
						System.out.println(num1+i);
						break;
					} !arrays.contains(num1+i) arrays.contains(num1+i) arrays.contains arrays num1+i num1 i {
						System.out.println(num1+i);
						break;
					} System.out.println(num1+i) System.out.println System.out System System.out num1+i num1 i break; String[] args args public class Main {
	public static void main (String[] args) throws IOException{
	    InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
	    BufferedReader in = new BufferedReader(reader);
	    String[] str1 = in.readLine().split(" ");
	    int num1 = Integer.parseInt(str1[0]);
	    int num2 = Integer.parseInt(str1[1]);

	    if(num2==0) {
			System.out.println(num1);
	    }else {
		    String[] str2 =in.readLine().split(" ");
		    List<Integer> arrays = new ArrayList<Integer>();
		    for(int i = 0; i<num2; i++) {
		    	arrays.add(Integer.parseInt(str2[i]));
		    }
			if(!arrays.contains(num1)) {
				System.out.println(num1);
			}else {
				for(int i=1; i<num2+1; i++) {
					if(num1>0) {
					}
					if(!arrays.contains(num1-i)) {
						System.out.println(num1-i);
						break;
					}else if(!arrays.contains(num1+i)) {
						System.out.println(num1+i);
						break;
					}
				}
			}
	    }
	}
} public class Main {
	public static void main (String[] args) throws IOException{
	    InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
	    BufferedReader in = new BufferedReader(reader);
	    String[] str1 = in.readLine().split(" ");
	    int num1 = Integer.parseInt(str1[0]);
	    int num2 = Integer.parseInt(str1[1]);

	    if(num2==0) {
			System.out.println(num1);
	    }else {
		    String[] str2 =in.readLine().split(" ");
		    List<Integer> arrays = new ArrayList<Integer>();
		    for(int i = 0; i<num2; i++) {
		    	arrays.add(Integer.parseInt(str2[i]));
		    }
			if(!arrays.contains(num1)) {
				System.out.println(num1);
			}else {
				for(int i=1; i<num2+1; i++) {
					if(num1>0) {
					}
					if(!arrays.contains(num1-i)) {
						System.out.println(num1-i);
						break;
					}else if(!arrays.contains(num1+i)) {
						System.out.println(num1+i);
						break;
					}
				}
			}
	    }
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;

public class Main {
	public static void main (String[] args) throws IOException{
	    InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
	    BufferedReader in = new BufferedReader(reader);
	    String[] str1 = in.readLine().split(" ");
	    int num1 = Integer.parseInt(str1[0]);
	    int num2 = Integer.parseInt(str1[1]);

	    if(num2==0) {
			System.out.println(num1);
	    }else {
		    String[] str2 =in.readLine().split(" ");
		    List<Integer> arrays = new ArrayList<Integer>();
		    for(int i = 0; i<num2; i++) {
		    	arrays.add(Integer.parseInt(str2[i]));
		    }
			if(!arrays.contains(num1)) {
				System.out.println(num1);
			}else {
				for(int i=1; i<num2+1; i++) {
					if(num1>0) {
					}
					if(!arrays.contains(num1-i)) {
						System.out.println(num1-i);
						break;
					}else if(!arrays.contains(num1+i)) {
						System.out.println(num1+i);
						break;
					}
				}
			}
	    }
	}
}