import java.util.*;
public class Main{
	public static void main(String[] args)
	{
		 Scanner sc=new Scanner(System.in);
		 int i=sc.nextInt();
		 int j=sc.nextInt();
		 int min=9999;
		 int arr[]=new int[j];
		 List<Integer> li1=new ArrayList<Integer>();
		 int flag=0;
		 if(j==0)
		 {
			 System.out.println(i);
			 return;
		 }
		 for(int k=0;k<j;k++)
		 {
			 arr[k]=sc.nextInt();
			 li1.add(arr[k]);
		 }
		 if(!li1.contains(i))
		 {
			 System.out.println(i);
			 return;
		 }
		
		 for(int k=0;k<=j;k++)
		 {
			if((li1.contains(i+k))&&(li1.contains(i-k)))
			 { 
				 continue;
			 }
           
			 if(!li1.contains(i-k))
			 {
				 flag=1;
				
				 System.out.println(i-k);
                 break;
				 
			 }
			 if(!li1.contains(i+k))
			 {
				 flag=1;
				 System.out.println(i+k);
                 break;
				 
			 }
			 
			 
			 
			 
			 
		 }
		 
		 
	}

} import java.util.*; util.* java public class Main{
	public static void main(String[] args)
	{
		 Scanner sc=new Scanner(System.in);
		 int i=sc.nextInt();
		 int j=sc.nextInt();
		 int min=9999;
		 int arr[]=new int[j];
		 List<Integer> li1=new ArrayList<Integer>();
		 int flag=0;
		 if(j==0)
		 {
			 System.out.println(i);
			 return;
		 }
		 for(int k=0;k<j;k++)
		 {
			 arr[k]=sc.nextInt();
			 li1.add(arr[k]);
		 }
		 if(!li1.contains(i))
		 {
			 System.out.println(i);
			 return;
		 }
		
		 for(int k=0;k<=j;k++)
		 {
			if((li1.contains(i+k))&&(li1.contains(i-k)))
			 { 
				 continue;
			 }
           
			 if(!li1.contains(i-k))
			 {
				 flag=1;
				
				 System.out.println(i-k);
                 break;
				 
			 }
			 if(!li1.contains(i+k))
			 {
				 flag=1;
				 System.out.println(i+k);
                 break;
				 
			 }
			 
			 
			 
			 
			 
		 }
		 
		 
	}

} Main public static void main(String[] args)
	{
		 Scanner sc=new Scanner(System.in);
		 int i=sc.nextInt();
		 int j=sc.nextInt();
		 int min=9999;
		 int arr[]=new int[j];
		 List<Integer> li1=new ArrayList<Integer>();
		 int flag=0;
		 if(j==0)
		 {
			 System.out.println(i);
			 return;
		 }
		 for(int k=0;k<j;k++)
		 {
			 arr[k]=sc.nextInt();
			 li1.add(arr[k]);
		 }
		 if(!li1.contains(i))
		 {
			 System.out.println(i);
			 return;
		 }
		
		 for(int k=0;k<=j;k++)
		 {
			if((li1.contains(i+k))&&(li1.contains(i-k)))
			 { 
				 continue;
			 }
           
			 if(!li1.contains(i-k))
			 {
				 flag=1;
				
				 System.out.println(i-k);
                 break;
				 
			 }
			 if(!li1.contains(i+k))
			 {
				 flag=1;
				 System.out.println(i+k);
                 break;
				 
			 }
			 
			 
			 
			 
			 
		 }
		 
		 
	} main {
		 Scanner sc=new Scanner(System.in);
		 int i=sc.nextInt();
		 int j=sc.nextInt();
		 int min=9999;
		 int arr[]=new int[j];
		 List<Integer> li1=new ArrayList<Integer>();
		 int flag=0;
		 if(j==0)
		 {
			 System.out.println(i);
			 return;
		 }
		 for(int k=0;k<j;k++)
		 {
			 arr[k]=sc.nextInt();
			 li1.add(arr[k]);
		 }
		 if(!li1.contains(i))
		 {
			 System.out.println(i);
			 return;
		 }
		
		 for(int k=0;k<=j;k++)
		 {
			if((li1.contains(i+k))&&(li1.contains(i-k)))
			 { 
				 continue;
			 }
           
			 if(!li1.contains(i-k))
			 {
				 flag=1;
				
				 System.out.println(i-k);
                 break;
				 
			 }
			 if(!li1.contains(i+k))
			 {
				 flag=1;
				 System.out.println(i+k);
                 break;
				 
			 }
			 
			 
			 
			 
			 
		 }
		 
		 
	} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int i=sc.nextInt(); i sc.nextInt() sc.nextInt sc int j=sc.nextInt(); j sc.nextInt() sc.nextInt sc int min=9999; min 9999 int arr[]=new int[j]; arr new int[j] j List<Integer> li1=new ArrayList<Integer>(); li1 new ArrayList<Integer>() int flag=0; flag 0 if(j==0)
		 {
			 System.out.println(i);
			 return;
		 } j==0 j 0 {
			 System.out.println(i);
			 return;
		 } System.out.println(i) System.out.println System.out System System.out i return; for(int k=0;k<j;k++)
		 {
			 arr[k]=sc.nextInt();
			 li1.add(arr[k]);
		 } int k=0; int k=0; k 0 k<j k j k++ k++ k {
			 arr[k]=sc.nextInt();
			 li1.add(arr[k]);
		 } {
			 arr[k]=sc.nextInt();
			 li1.add(arr[k]);
		 } arr[k]=sc.nextInt() arr[k] arr k sc.nextInt() sc.nextInt sc li1.add(arr[k]) li1.add li1 arr[k] arr k if(!li1.contains(i))
		 {
			 System.out.println(i);
			 return;
		 } !li1.contains(i) li1.contains(i) li1.contains li1 i {
			 System.out.println(i);
			 return;
		 } System.out.println(i) System.out.println System.out System System.out i return; for(int k=0;k<=j;k++)
		 {
			if((li1.contains(i+k))&&(li1.contains(i-k)))
			 { 
				 continue;
			 }
           
			 if(!li1.contains(i-k))
			 {
				 flag=1;
				
				 System.out.println(i-k);
                 break;
				 
			 }
			 if(!li1.contains(i+k))
			 {
				 flag=1;
				 System.out.println(i+k);
                 break;
				 
			 }
			 
			 
			 
			 
			 
		 } int k=0; int k=0; k 0 k<=j k j k++ k++ k {
			if((li1.contains(i+k))&&(li1.contains(i-k)))
			 { 
				 continue;
			 }
           
			 if(!li1.contains(i-k))
			 {
				 flag=1;
				
				 System.out.println(i-k);
                 break;
				 
			 }
			 if(!li1.contains(i+k))
			 {
				 flag=1;
				 System.out.println(i+k);
                 break;
				 
			 }
			 
			 
			 
			 
			 
		 } {
			if((li1.contains(i+k))&&(li1.contains(i-k)))
			 { 
				 continue;
			 }
           
			 if(!li1.contains(i-k))
			 {
				 flag=1;
				
				 System.out.println(i-k);
                 break;
				 
			 }
			 if(!li1.contains(i+k))
			 {
				 flag=1;
				 System.out.println(i+k);
                 break;
				 
			 }
			 
			 
			 
			 
			 
		 } if((li1.contains(i+k))&&(li1.contains(i-k)))
			 { 
				 continue;
			 } (li1.contains(i+k))&&(li1.contains(i-k)) (li1.contains(i+k)) li1.contains li1 i+k i k (li1.contains(i-k)) li1.contains li1 i-k i k { 
				 continue;
			 } continue; if(!li1.contains(i-k))
			 {
				 flag=1;
				
				 System.out.println(i-k);
                 break;
				 
			 } !li1.contains(i-k) li1.contains(i-k) li1.contains li1 i-k i k {
				 flag=1;
				
				 System.out.println(i-k);
                 break;
				 
			 } flag=1 flag 1 System.out.println(i-k) System.out.println System.out System System.out i-k i k break; if(!li1.contains(i+k))
			 {
				 flag=1;
				 System.out.println(i+k);
                 break;
				 
			 } !li1.contains(i+k) li1.contains(i+k) li1.contains li1 i+k i k {
				 flag=1;
				 System.out.println(i+k);
                 break;
				 
			 } flag=1 flag 1 System.out.println(i+k) System.out.println System.out System System.out i+k i k break; String[] args args public class Main{
	public static void main(String[] args)
	{
		 Scanner sc=new Scanner(System.in);
		 int i=sc.nextInt();
		 int j=sc.nextInt();
		 int min=9999;
		 int arr[]=new int[j];
		 List<Integer> li1=new ArrayList<Integer>();
		 int flag=0;
		 if(j==0)
		 {
			 System.out.println(i);
			 return;
		 }
		 for(int k=0;k<j;k++)
		 {
			 arr[k]=sc.nextInt();
			 li1.add(arr[k]);
		 }
		 if(!li1.contains(i))
		 {
			 System.out.println(i);
			 return;
		 }
		
		 for(int k=0;k<=j;k++)
		 {
			if((li1.contains(i+k))&&(li1.contains(i-k)))
			 { 
				 continue;
			 }
           
			 if(!li1.contains(i-k))
			 {
				 flag=1;
				
				 System.out.println(i-k);
                 break;
				 
			 }
			 if(!li1.contains(i+k))
			 {
				 flag=1;
				 System.out.println(i+k);
                 break;
				 
			 }
			 
			 
			 
			 
			 
		 }
		 
		 
	}

} public class Main{
	public static void main(String[] args)
	{
		 Scanner sc=new Scanner(System.in);
		 int i=sc.nextInt();
		 int j=sc.nextInt();
		 int min=9999;
		 int arr[]=new int[j];
		 List<Integer> li1=new ArrayList<Integer>();
		 int flag=0;
		 if(j==0)
		 {
			 System.out.println(i);
			 return;
		 }
		 for(int k=0;k<j;k++)
		 {
			 arr[k]=sc.nextInt();
			 li1.add(arr[k]);
		 }
		 if(!li1.contains(i))
		 {
			 System.out.println(i);
			 return;
		 }
		
		 for(int k=0;k<=j;k++)
		 {
			if((li1.contains(i+k))&&(li1.contains(i-k)))
			 { 
				 continue;
			 }
           
			 if(!li1.contains(i-k))
			 {
				 flag=1;
				
				 System.out.println(i-k);
                 break;
				 
			 }
			 if(!li1.contains(i+k))
			 {
				 flag=1;
				 System.out.println(i+k);
                 break;
				 
			 }
			 
			 
			 
			 
			 
		 }
		 
		 
	}

} Main
import java.util.*;
public class Main{
	public static void main(String[] args)
	{
		 Scanner sc=new Scanner(System.in);
		 int i=sc.nextInt();
		 int j=sc.nextInt();
		 int min=9999;
		 int arr[]=new int[j];
		 List<Integer> li1=new ArrayList<Integer>();
		 int flag=0;
		 if(j==0)
		 {
			 System.out.println(i);
			 return;
		 }
		 for(int k=0;k<j;k++)
		 {
			 arr[k]=sc.nextInt();
			 li1.add(arr[k]);
		 }
		 if(!li1.contains(i))
		 {
			 System.out.println(i);
			 return;
		 }
		
		 for(int k=0;k<=j;k++)
		 {
			if((li1.contains(i+k))&&(li1.contains(i-k)))
			 { 
				 continue;
			 }
           
			 if(!li1.contains(i-k))
			 {
				 flag=1;
				
				 System.out.println(i-k);
                 break;
				 
			 }
			 if(!li1.contains(i+k))
			 {
				 flag=1;
				 System.out.println(i+k);
                 break;
				 
			 }
			 
			 
			 
			 
			 
		 }
		 
		 
	}

}
