import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner s = new Scanner(System.in);
        int X = s.nextInt();
        int N = s.nextInt();
        Boolean check[] =  new Boolean[102];
        for(int i = 0; i < 102; i++){
            check[i] = true;
        } 
        for(int i = 0; i < N; i++ ) {
            check[s.nextInt()] = false;
        }
        int puraN = X;
        int maiN = X;
        int i = 0;
        int answer = X;
        while(!check[X]){
            if(i % 2 == 0){
                maiN -= 1;
                if(check[maiN]){
                    answer = maiN;
                    break;
                } 
            }
            if(i % 2 != 0){
                puraN += 1;
                if(check[puraN]){
                     answer = puraN;
                    break; 
                }
            }
            i += 1;
                
        }    
        
        System.out.println(answer); 
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner s = new Scanner(System.in);
        int X = s.nextInt();
        int N = s.nextInt();
        Boolean check[] =  new Boolean[102];
        for(int i = 0; i < 102; i++){
            check[i] = true;
        } 
        for(int i = 0; i < N; i++ ) {
            check[s.nextInt()] = false;
        }
        int puraN = X;
        int maiN = X;
        int i = 0;
        int answer = X;
        while(!check[X]){
            if(i % 2 == 0){
                maiN -= 1;
                if(check[maiN]){
                    answer = maiN;
                    break;
                } 
            }
            if(i % 2 != 0){
                puraN += 1;
                if(check[puraN]){
                     answer = puraN;
                    break; 
                }
            }
            i += 1;
                
        }    
        
        System.out.println(answer); 
    }
} Main public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner s = new Scanner(System.in);
        int X = s.nextInt();
        int N = s.nextInt();
        Boolean check[] =  new Boolean[102];
        for(int i = 0; i < 102; i++){
            check[i] = true;
        } 
        for(int i = 0; i < N; i++ ) {
            check[s.nextInt()] = false;
        }
        int puraN = X;
        int maiN = X;
        int i = 0;
        int answer = X;
        while(!check[X]){
            if(i % 2 == 0){
                maiN -= 1;
                if(check[maiN]){
                    answer = maiN;
                    break;
                } 
            }
            if(i % 2 != 0){
                puraN += 1;
                if(check[puraN]){
                     answer = puraN;
                    break; 
                }
            }
            i += 1;
                
        }    
        
        System.out.println(answer); 
    } main {
        // Your code here!
        Scanner s = new Scanner(System.in);
        int X = s.nextInt();
        int N = s.nextInt();
        Boolean check[] =  new Boolean[102];
        for(int i = 0; i < 102; i++){
            check[i] = true;
        } 
        for(int i = 0; i < N; i++ ) {
            check[s.nextInt()] = false;
        }
        int puraN = X;
        int maiN = X;
        int i = 0;
        int answer = X;
        while(!check[X]){
            if(i % 2 == 0){
                maiN -= 1;
                if(check[maiN]){
                    answer = maiN;
                    break;
                } 
            }
            if(i % 2 != 0){
                puraN += 1;
                if(check[puraN]){
                     answer = puraN;
                    break; 
                }
            }
            i += 1;
                
        }    
        
        System.out.println(answer); 
    } 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 Boolean check[] =  new Boolean[102]; check new Boolean[102] 102 for(int i = 0; i < 102; i++){
            check[i] = true;
        } int i = 0; int i = 0; i 0 i < 102 i 102 i++ i++ i {
            check[i] = true;
        } {
            check[i] = true;
        } check[i] = true check[i] check i true for(int i = 0; i < N; i++ ) {
            check[s.nextInt()] = false;
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            check[s.nextInt()] = false;
        } {
            check[s.nextInt()] = false;
        } check[s.nextInt()] = false check[s.nextInt()] check s.nextInt() s.nextInt s false int puraN = X; puraN X int maiN = X; maiN X int i = 0; i 0 int answer = X; answer X while(!check[X]){
            if(i % 2 == 0){
                maiN -= 1;
                if(check[maiN]){
                    answer = maiN;
                    break;
                } 
            }
            if(i % 2 != 0){
                puraN += 1;
                if(check[puraN]){
                     answer = puraN;
                    break; 
                }
            }
            i += 1;
                
        } !check[X] check[X] check X {
            if(i % 2 == 0){
                maiN -= 1;
                if(check[maiN]){
                    answer = maiN;
                    break;
                } 
            }
            if(i % 2 != 0){
                puraN += 1;
                if(check[puraN]){
                     answer = puraN;
                    break; 
                }
            }
            i += 1;
                
        } if(i % 2 == 0){
                maiN -= 1;
                if(check[maiN]){
                    answer = maiN;
                    break;
                } 
            } i % 2 == 0 i % 2 i 2 0 {
                maiN -= 1;
                if(check[maiN]){
                    answer = maiN;
                    break;
                } 
            } maiN -= 1 maiN 1 if(check[maiN]){
                    answer = maiN;
                    break;
                } check[maiN] check maiN {
                    answer = maiN;
                    break;
                } answer = maiN answer maiN break; if(i % 2 != 0){
                puraN += 1;
                if(check[puraN]){
                     answer = puraN;
                    break; 
                }
            } i % 2 != 0 i % 2 i 2 0 {
                puraN += 1;
                if(check[puraN]){
                     answer = puraN;
                    break; 
                }
            } puraN += 1 puraN 1 if(check[puraN]){
                     answer = puraN;
                    break; 
                } check[puraN] check puraN {
                     answer = puraN;
                    break; 
                } answer = puraN answer puraN break; i += 1 i 1 System.out.println(answer) System.out.println System.out System System.out answer String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner s = new Scanner(System.in);
        int X = s.nextInt();
        int N = s.nextInt();
        Boolean check[] =  new Boolean[102];
        for(int i = 0; i < 102; i++){
            check[i] = true;
        } 
        for(int i = 0; i < N; i++ ) {
            check[s.nextInt()] = false;
        }
        int puraN = X;
        int maiN = X;
        int i = 0;
        int answer = X;
        while(!check[X]){
            if(i % 2 == 0){
                maiN -= 1;
                if(check[maiN]){
                    answer = maiN;
                    break;
                } 
            }
            if(i % 2 != 0){
                puraN += 1;
                if(check[puraN]){
                     answer = puraN;
                    break; 
                }
            }
            i += 1;
                
        }    
        
        System.out.println(answer); 
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner s = new Scanner(System.in);
        int X = s.nextInt();
        int N = s.nextInt();
        Boolean check[] =  new Boolean[102];
        for(int i = 0; i < 102; i++){
            check[i] = true;
        } 
        for(int i = 0; i < N; i++ ) {
            check[s.nextInt()] = false;
        }
        int puraN = X;
        int maiN = X;
        int i = 0;
        int answer = X;
        while(!check[X]){
            if(i % 2 == 0){
                maiN -= 1;
                if(check[maiN]){
                    answer = maiN;
                    break;
                } 
            }
            if(i % 2 != 0){
                puraN += 1;
                if(check[puraN]){
                     answer = puraN;
                    break; 
                }
            }
            i += 1;
                
        }    
        
        System.out.println(answer); 
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner s = new Scanner(System.in);
        int X = s.nextInt();
        int N = s.nextInt();
        Boolean check[] =  new Boolean[102];
        for(int i = 0; i < 102; i++){
            check[i] = true;
        } 
        for(int i = 0; i < N; i++ ) {
            check[s.nextInt()] = false;
        }
        int puraN = X;
        int maiN = X;
        int i = 0;
        int answer = X;
        while(!check[X]){
            if(i % 2 == 0){
                maiN -= 1;
                if(check[maiN]){
                    answer = maiN;
                    break;
                } 
            }
            if(i % 2 != 0){
                puraN += 1;
                if(check[puraN]){
                     answer = puraN;
                    break; 
                }
            }
            i += 1;
                
        }    
        
        System.out.println(answer); 
    }
}
