import java.util.*;
import java.io.*;
public class Main{
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                Map hs = new HashMap();
                PrintWriter ou = new PrintWriter(System.out);
                int x = Integer.parseInt(sc.next());
                int n = Integer.parseInt(sc.next());
                boolean[] q = new boolean[102];
                Arrays.fill(q , true);
                for(int i = 0 ; i < n ; i++){
                        q[Integer.parseInt(sc.next())] = false;
                }
                int s = 0;
                boolean ebishu = true;
                while(ebishu){
                        if(q[Math.max(0 , x - s)] == true){
                                ou.print(x - s + "\n");
                                ebishu = false;
                        }else if(q[Math.min(101 , x + s)] == true){
                                ou.print(x + s + "\n");
                                ebishu = false;
                        }
                        s++;
                }
                sc.close();
                ou.flush();
        }
} 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);
                Map hs = new HashMap();
                PrintWriter ou = new PrintWriter(System.out);
                int x = Integer.parseInt(sc.next());
                int n = Integer.parseInt(sc.next());
                boolean[] q = new boolean[102];
                Arrays.fill(q , true);
                for(int i = 0 ; i < n ; i++){
                        q[Integer.parseInt(sc.next())] = false;
                }
                int s = 0;
                boolean ebishu = true;
                while(ebishu){
                        if(q[Math.max(0 , x - s)] == true){
                                ou.print(x - s + "\n");
                                ebishu = false;
                        }else if(q[Math.min(101 , x + s)] == true){
                                ou.print(x + s + "\n");
                                ebishu = false;
                        }
                        s++;
                }
                sc.close();
                ou.flush();
        }
} Main public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                Map hs = new HashMap();
                PrintWriter ou = new PrintWriter(System.out);
                int x = Integer.parseInt(sc.next());
                int n = Integer.parseInt(sc.next());
                boolean[] q = new boolean[102];
                Arrays.fill(q , true);
                for(int i = 0 ; i < n ; i++){
                        q[Integer.parseInt(sc.next())] = false;
                }
                int s = 0;
                boolean ebishu = true;
                while(ebishu){
                        if(q[Math.max(0 , x - s)] == true){
                                ou.print(x - s + "\n");
                                ebishu = false;
                        }else if(q[Math.min(101 , x + s)] == true){
                                ou.print(x + s + "\n");
                                ebishu = false;
                        }
                        s++;
                }
                sc.close();
                ou.flush();
        } main {
                Scanner sc = new Scanner(System.in);
                Map hs = new HashMap();
                PrintWriter ou = new PrintWriter(System.out);
                int x = Integer.parseInt(sc.next());
                int n = Integer.parseInt(sc.next());
                boolean[] q = new boolean[102];
                Arrays.fill(q , true);
                for(int i = 0 ; i < n ; i++){
                        q[Integer.parseInt(sc.next())] = false;
                }
                int s = 0;
                boolean ebishu = true;
                while(ebishu){
                        if(q[Math.max(0 , x - s)] == true){
                                ou.print(x - s + "\n");
                                ebishu = false;
                        }else if(q[Math.min(101 , x + s)] == true){
                                ou.print(x + s + "\n");
                                ebishu = false;
                        }
                        s++;
                }
                sc.close();
                ou.flush();
        } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Map hs = new HashMap(); hs new HashMap() PrintWriter ou = new PrintWriter(System.out); ou new PrintWriter(System.out) int x = Integer.parseInt(sc.next()); x Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc boolean[] q = new boolean[102]; q new boolean[102] 102 Arrays.fill(q , true) Arrays.fill Arrays q true for(int i = 0 ; i < n ; i++){
                        q[Integer.parseInt(sc.next())] = false;
                } int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i {
                        q[Integer.parseInt(sc.next())] = false;
                } {
                        q[Integer.parseInt(sc.next())] = false;
                } q[Integer.parseInt(sc.next())] = false q[Integer.parseInt(sc.next())] q Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc false int s = 0; s 0 boolean ebishu = true; ebishu true while(ebishu){
                        if(q[Math.max(0 , x - s)] == true){
                                ou.print(x - s + "\n");
                                ebishu = false;
                        }else if(q[Math.min(101 , x + s)] == true){
                                ou.print(x + s + "\n");
                                ebishu = false;
                        }
                        s++;
                } ebishu {
                        if(q[Math.max(0 , x - s)] == true){
                                ou.print(x - s + "\n");
                                ebishu = false;
                        }else if(q[Math.min(101 , x + s)] == true){
                                ou.print(x + s + "\n");
                                ebishu = false;
                        }
                        s++;
                } if(q[Math.max(0 , x - s)] == true){
                                ou.print(x - s + "\n");
                                ebishu = false;
                        }else if(q[Math.min(101 , x + s)] == true){
                                ou.print(x + s + "\n");
                                ebishu = false;
                        } q[Math.max(0 , x - s)] == true q[Math.max(0 , x - s)] q Math.max(0 , x - s) Math.max Math 0 x - s x s true {
                                ou.print(x - s + "\n");
                                ebishu = false;
                        } ou.print(x - s + "\n") ou.print ou x - s + "\n" x - s x s "\n" ebishu = false ebishu false if(q[Math.min(101 , x + s)] == true){
                                ou.print(x + s + "\n");
                                ebishu = false;
                        } q[Math.min(101 , x + s)] == true q[Math.min(101 , x + s)] q Math.min(101 , x + s) Math.min Math 101 x + s x s true {
                                ou.print(x + s + "\n");
                                ebishu = false;
                        } ou.print(x + s + "\n") ou.print ou x + s + "\n" x + s + "\n" x s "\n" ebishu = false ebishu false s++ s sc.close() sc.close sc ou.flush() ou.flush ou String[] args args public class Main{
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                Map hs = new HashMap();
                PrintWriter ou = new PrintWriter(System.out);
                int x = Integer.parseInt(sc.next());
                int n = Integer.parseInt(sc.next());
                boolean[] q = new boolean[102];
                Arrays.fill(q , true);
                for(int i = 0 ; i < n ; i++){
                        q[Integer.parseInt(sc.next())] = false;
                }
                int s = 0;
                boolean ebishu = true;
                while(ebishu){
                        if(q[Math.max(0 , x - s)] == true){
                                ou.print(x - s + "\n");
                                ebishu = false;
                        }else if(q[Math.min(101 , x + s)] == true){
                                ou.print(x + s + "\n");
                                ebishu = false;
                        }
                        s++;
                }
                sc.close();
                ou.flush();
        }
} public class Main{
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                Map hs = new HashMap();
                PrintWriter ou = new PrintWriter(System.out);
                int x = Integer.parseInt(sc.next());
                int n = Integer.parseInt(sc.next());
                boolean[] q = new boolean[102];
                Arrays.fill(q , true);
                for(int i = 0 ; i < n ; i++){
                        q[Integer.parseInt(sc.next())] = false;
                }
                int s = 0;
                boolean ebishu = true;
                while(ebishu){
                        if(q[Math.max(0 , x - s)] == true){
                                ou.print(x - s + "\n");
                                ebishu = false;
                        }else if(q[Math.min(101 , x + s)] == true){
                                ou.print(x + s + "\n");
                                ebishu = false;
                        }
                        s++;
                }
                sc.close();
                ou.flush();
        }
} Main
import java.util.*;
import java.io.*;
public class Main{
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                Map hs = new HashMap();
                PrintWriter ou = new PrintWriter(System.out);
                int x = Integer.parseInt(sc.next());
                int n = Integer.parseInt(sc.next());
                boolean[] q = new boolean[102];
                Arrays.fill(q , true);
                for(int i = 0 ; i < n ; i++){
                        q[Integer.parseInt(sc.next())] = false;
                }
                int s = 0;
                boolean ebishu = true;
                while(ebishu){
                        if(q[Math.max(0 , x - s)] == true){
                                ou.print(x - s + "\n");
                                ebishu = false;
                        }else if(q[Math.min(101 , x + s)] == true){
                                ou.print(x + s + "\n");
                                ebishu = false;
                        }
                        s++;
                }
                sc.close();
                ou.flush();
        }
}