import java.util.*;
import java.io.*;
public class Main {
       public static void main(String args[]) {
           Scanner sc = new Scanner(System.in);
           int  x =  sc.nextInt();
           int  y =  sc.nextInt();
           if(y == 0)  {
               System.out.println(x);
           }
           else {
               HashSet<Integer> hs = new HashSet<Integer>();
               for(int i = 0; i < y; i++) {
                    hs.add(sc.nextInt());
               }
               if(hs.contains(x) == false) 
                              System.out.println(x);
               else {
                               for(int i = 1; i <= 100; i++) {
                        
                          if(hs.contains(x-i) == false) {
                                     System.out.println(x-i);
                                     break;
                          }
                          if(hs.contains(x+i) == false) {
                                     System.out.println(x+i); 
                                     break;
                          }
               }
}
           }
       }
} import java.util.*; util.* java import java.io.*; io.* java public class Main {
       public static void main(String args[]) {
           Scanner sc = new Scanner(System.in);
           int  x =  sc.nextInt();
           int  y =  sc.nextInt();
           if(y == 0)  {
               System.out.println(x);
           }
           else {
               HashSet<Integer> hs = new HashSet<Integer>();
               for(int i = 0; i < y; i++) {
                    hs.add(sc.nextInt());
               }
               if(hs.contains(x) == false) 
                              System.out.println(x);
               else {
                               for(int i = 1; i <= 100; i++) {
                        
                          if(hs.contains(x-i) == false) {
                                     System.out.println(x-i);
                                     break;
                          }
                          if(hs.contains(x+i) == false) {
                                     System.out.println(x+i); 
                                     break;
                          }
               }
}
           }
       }
} Main public static void main(String args[]) {
           Scanner sc = new Scanner(System.in);
           int  x =  sc.nextInt();
           int  y =  sc.nextInt();
           if(y == 0)  {
               System.out.println(x);
           }
           else {
               HashSet<Integer> hs = new HashSet<Integer>();
               for(int i = 0; i < y; i++) {
                    hs.add(sc.nextInt());
               }
               if(hs.contains(x) == false) 
                              System.out.println(x);
               else {
                               for(int i = 1; i <= 100; i++) {
                        
                          if(hs.contains(x-i) == false) {
                                     System.out.println(x-i);
                                     break;
                          }
                          if(hs.contains(x+i) == false) {
                                     System.out.println(x+i); 
                                     break;
                          }
               }
}
           }
       } main {
           Scanner sc = new Scanner(System.in);
           int  x =  sc.nextInt();
           int  y =  sc.nextInt();
           if(y == 0)  {
               System.out.println(x);
           }
           else {
               HashSet<Integer> hs = new HashSet<Integer>();
               for(int i = 0; i < y; i++) {
                    hs.add(sc.nextInt());
               }
               if(hs.contains(x) == false) 
                              System.out.println(x);
               else {
                               for(int i = 1; i <= 100; i++) {
                        
                          if(hs.contains(x-i) == false) {
                                     System.out.println(x-i);
                                     break;
                          }
                          if(hs.contains(x+i) == false) {
                                     System.out.println(x+i); 
                                     break;
                          }
               }
}
           }
       } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int  x =  sc.nextInt(); x sc.nextInt() sc.nextInt sc int  y =  sc.nextInt(); y sc.nextInt() sc.nextInt sc if(y == 0)  {
               System.out.println(x);
           }
           else {
               HashSet<Integer> hs = new HashSet<Integer>();
               for(int i = 0; i < y; i++) {
                    hs.add(sc.nextInt());
               }
               if(hs.contains(x) == false) 
                              System.out.println(x);
               else {
                               for(int i = 1; i <= 100; i++) {
                        
                          if(hs.contains(x-i) == false) {
                                     System.out.println(x-i);
                                     break;
                          }
                          if(hs.contains(x+i) == false) {
                                     System.out.println(x+i); 
                                     break;
                          }
               }
}
           } y == 0 y 0 {
               System.out.println(x);
           } System.out.println(x) System.out.println System.out System System.out x {
               HashSet<Integer> hs = new HashSet<Integer>();
               for(int i = 0; i < y; i++) {
                    hs.add(sc.nextInt());
               }
               if(hs.contains(x) == false) 
                              System.out.println(x);
               else {
                               for(int i = 1; i <= 100; i++) {
                        
                          if(hs.contains(x-i) == false) {
                                     System.out.println(x-i);
                                     break;
                          }
                          if(hs.contains(x+i) == false) {
                                     System.out.println(x+i); 
                                     break;
                          }
               }
}
           } HashSet<Integer> hs = new HashSet<Integer>(); hs new HashSet<Integer>() for(int i = 0; i < y; i++) {
                    hs.add(sc.nextInt());
               } int i = 0; int i = 0; i 0 i < y i y i++ i++ i {
                    hs.add(sc.nextInt());
               } {
                    hs.add(sc.nextInt());
               } hs.add(sc.nextInt()) hs.add hs sc.nextInt() sc.nextInt sc if(hs.contains(x) == false) 
                              System.out.println(x);
               else {
                               for(int i = 1; i <= 100; i++) {
                        
                          if(hs.contains(x-i) == false) {
                                     System.out.println(x-i);
                                     break;
                          }
                          if(hs.contains(x+i) == false) {
                                     System.out.println(x+i); 
                                     break;
                          }
               }
} hs.contains(x) == false hs.contains(x) hs.contains hs x false System.out.println(x) System.out.println System.out System System.out x {
                               for(int i = 1; i <= 100; i++) {
                        
                          if(hs.contains(x-i) == false) {
                                     System.out.println(x-i);
                                     break;
                          }
                          if(hs.contains(x+i) == false) {
                                     System.out.println(x+i); 
                                     break;
                          }
               }
} for(int i = 1; i <= 100; i++) {
                        
                          if(hs.contains(x-i) == false) {
                                     System.out.println(x-i);
                                     break;
                          }
                          if(hs.contains(x+i) == false) {
                                     System.out.println(x+i); 
                                     break;
                          }
               } int i = 1; int i = 1; i 1 i <= 100 i 100 i++ i++ i {
                        
                          if(hs.contains(x-i) == false) {
                                     System.out.println(x-i);
                                     break;
                          }
                          if(hs.contains(x+i) == false) {
                                     System.out.println(x+i); 
                                     break;
                          }
               } {
                        
                          if(hs.contains(x-i) == false) {
                                     System.out.println(x-i);
                                     break;
                          }
                          if(hs.contains(x+i) == false) {
                                     System.out.println(x+i); 
                                     break;
                          }
               } if(hs.contains(x-i) == false) {
                                     System.out.println(x-i);
                                     break;
                          } hs.contains(x-i) == false hs.contains(x-i) hs.contains hs x-i x i false {
                                     System.out.println(x-i);
                                     break;
                          } System.out.println(x-i) System.out.println System.out System System.out x-i x i break; if(hs.contains(x+i) == false) {
                                     System.out.println(x+i); 
                                     break;
                          } hs.contains(x+i) == false hs.contains(x+i) hs.contains hs x+i x i false {
                                     System.out.println(x+i); 
                                     break;
                          } System.out.println(x+i) System.out.println System.out System System.out x+i x i break; String args[] args public class Main {
       public static void main(String args[]) {
           Scanner sc = new Scanner(System.in);
           int  x =  sc.nextInt();
           int  y =  sc.nextInt();
           if(y == 0)  {
               System.out.println(x);
           }
           else {
               HashSet<Integer> hs = new HashSet<Integer>();
               for(int i = 0; i < y; i++) {
                    hs.add(sc.nextInt());
               }
               if(hs.contains(x) == false) 
                              System.out.println(x);
               else {
                               for(int i = 1; i <= 100; i++) {
                        
                          if(hs.contains(x-i) == false) {
                                     System.out.println(x-i);
                                     break;
                          }
                          if(hs.contains(x+i) == false) {
                                     System.out.println(x+i); 
                                     break;
                          }
               }
}
           }
       }
} public class Main {
       public static void main(String args[]) {
           Scanner sc = new Scanner(System.in);
           int  x =  sc.nextInt();
           int  y =  sc.nextInt();
           if(y == 0)  {
               System.out.println(x);
           }
           else {
               HashSet<Integer> hs = new HashSet<Integer>();
               for(int i = 0; i < y; i++) {
                    hs.add(sc.nextInt());
               }
               if(hs.contains(x) == false) 
                              System.out.println(x);
               else {
                               for(int i = 1; i <= 100; i++) {
                        
                          if(hs.contains(x-i) == false) {
                                     System.out.println(x-i);
                                     break;
                          }
                          if(hs.contains(x+i) == false) {
                                     System.out.println(x+i); 
                                     break;
                          }
               }
}
           }
       }
} Main
import java.util.*;
import java.io.*;
public class Main {
       public static void main(String args[]) {
           Scanner sc = new Scanner(System.in);
           int  x =  sc.nextInt();
           int  y =  sc.nextInt();
           if(y == 0)  {
               System.out.println(x);
           }
           else {
               HashSet<Integer> hs = new HashSet<Integer>();
               for(int i = 0; i < y; i++) {
                    hs.add(sc.nextInt());
               }
               if(hs.contains(x) == false) 
                              System.out.println(x);
               else {
                               for(int i = 1; i <= 100; i++) {
                        
                          if(hs.contains(x-i) == false) {
                                     System.out.println(x-i);
                                     break;
                          }
                          if(hs.contains(x+i) == false) {
                                     System.out.println(x+i); 
                                     break;
                          }
               }
}
           }
       }
}