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