import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main{
	public static void main(String[] args)
	{
		 Scanner sc=new Scanner(System.in);
		 int i=sc.nextInt();
		 int j=sc.nextInt();
		 int arr[]=new int[j];
		 List li1=new ArrayList();
		 if(j==0)
		 {
			 System.out.println(i);
			 System.exit(0);
		 }
		 for(int k=0;k<j;k++)
		 {
			 arr[k]=sc.nextInt();
			 li1.add(arr[k]);
		 }
		 if(!li1.contains(i))
		 {
			 System.out.println(i);
			 System.exit(0);
		 }
		
		 for(int k=0;k<=j;k++)
		 {
			if((li1.contains(i+k))&&(li1.contains(i-k)))
			 { 
				 continue;
			 }
           
			 if(!li1.contains(i-k))
			 {
				 System.out.println(i-k);
                 break;
				 
			 }
			 if(!li1.contains(i+k))
			 {
				 System.out.println(i+k);
                 break;
				 
			 }	 
		 }
		 
		 
	}
 
} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner 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 arr[]=new int[j];
		 List li1=new ArrayList();
		 if(j==0)
		 {
			 System.out.println(i);
			 System.exit(0);
		 }
		 for(int k=0;k<j;k++)
		 {
			 arr[k]=sc.nextInt();
			 li1.add(arr[k]);
		 }
		 if(!li1.contains(i))
		 {
			 System.out.println(i);
			 System.exit(0);
		 }
		
		 for(int k=0;k<=j;k++)
		 {
			if((li1.contains(i+k))&&(li1.contains(i-k)))
			 { 
				 continue;
			 }
           
			 if(!li1.contains(i-k))
			 {
				 System.out.println(i-k);
                 break;
				 
			 }
			 if(!li1.contains(i+k))
			 {
				 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 arr[]=new int[j];
		 List li1=new ArrayList();
		 if(j==0)
		 {
			 System.out.println(i);
			 System.exit(0);
		 }
		 for(int k=0;k<j;k++)
		 {
			 arr[k]=sc.nextInt();
			 li1.add(arr[k]);
		 }
		 if(!li1.contains(i))
		 {
			 System.out.println(i);
			 System.exit(0);
		 }
		
		 for(int k=0;k<=j;k++)
		 {
			if((li1.contains(i+k))&&(li1.contains(i-k)))
			 { 
				 continue;
			 }
           
			 if(!li1.contains(i-k))
			 {
				 System.out.println(i-k);
                 break;
				 
			 }
			 if(!li1.contains(i+k))
			 {
				 System.out.println(i+k);
                 break;
				 
			 }	 
		 }
		 
		 
	} main {
		 Scanner sc=new Scanner(System.in);
		 int i=sc.nextInt();
		 int j=sc.nextInt();
		 int arr[]=new int[j];
		 List li1=new ArrayList();
		 if(j==0)
		 {
			 System.out.println(i);
			 System.exit(0);
		 }
		 for(int k=0;k<j;k++)
		 {
			 arr[k]=sc.nextInt();
			 li1.add(arr[k]);
		 }
		 if(!li1.contains(i))
		 {
			 System.out.println(i);
			 System.exit(0);
		 }
		
		 for(int k=0;k<=j;k++)
		 {
			if((li1.contains(i+k))&&(li1.contains(i-k)))
			 { 
				 continue;
			 }
           
			 if(!li1.contains(i-k))
			 {
				 System.out.println(i-k);
                 break;
				 
			 }
			 if(!li1.contains(i+k))
			 {
				 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 arr[]=new int[j]; arr new int[j] j List li1=new ArrayList(); li1 new ArrayList() if(j==0)
		 {
			 System.out.println(i);
			 System.exit(0);
		 } j==0 j 0 {
			 System.out.println(i);
			 System.exit(0);
		 } System.out.println(i) System.out.println System.out System System.out i System.exit(0) System.exit System 0 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);
			 System.exit(0);
		 } !li1.contains(i) li1.contains(i) li1.contains li1 i {
			 System.out.println(i);
			 System.exit(0);
		 } System.out.println(i) System.out.println System.out System System.out i System.exit(0) System.exit System 0 for(int k=0;k<=j;k++)
		 {
			if((li1.contains(i+k))&&(li1.contains(i-k)))
			 { 
				 continue;
			 }
           
			 if(!li1.contains(i-k))
			 {
				 System.out.println(i-k);
                 break;
				 
			 }
			 if(!li1.contains(i+k))
			 {
				 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))
			 {
				 System.out.println(i-k);
                 break;
				 
			 }
			 if(!li1.contains(i+k))
			 {
				 System.out.println(i+k);
                 break;
				 
			 }	 
		 } {
			if((li1.contains(i+k))&&(li1.contains(i-k)))
			 { 
				 continue;
			 }
           
			 if(!li1.contains(i-k))
			 {
				 System.out.println(i-k);
                 break;
				 
			 }
			 if(!li1.contains(i+k))
			 {
				 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))
			 {
				 System.out.println(i-k);
                 break;
				 
			 } !li1.contains(i-k) li1.contains(i-k) li1.contains li1 i-k i k {
				 System.out.println(i-k);
                 break;
				 
			 } System.out.println(i-k) System.out.println System.out System System.out i-k i k break; if(!li1.contains(i+k))
			 {
				 System.out.println(i+k);
                 break;
				 
			 } !li1.contains(i+k) li1.contains(i+k) li1.contains li1 i+k i k {
				 System.out.println(i+k);
                 break;
				 
			 } 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 arr[]=new int[j];
		 List li1=new ArrayList();
		 if(j==0)
		 {
			 System.out.println(i);
			 System.exit(0);
		 }
		 for(int k=0;k<j;k++)
		 {
			 arr[k]=sc.nextInt();
			 li1.add(arr[k]);
		 }
		 if(!li1.contains(i))
		 {
			 System.out.println(i);
			 System.exit(0);
		 }
		
		 for(int k=0;k<=j;k++)
		 {
			if((li1.contains(i+k))&&(li1.contains(i-k)))
			 { 
				 continue;
			 }
           
			 if(!li1.contains(i-k))
			 {
				 System.out.println(i-k);
                 break;
				 
			 }
			 if(!li1.contains(i+k))
			 {
				 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 arr[]=new int[j];
		 List li1=new ArrayList();
		 if(j==0)
		 {
			 System.out.println(i);
			 System.exit(0);
		 }
		 for(int k=0;k<j;k++)
		 {
			 arr[k]=sc.nextInt();
			 li1.add(arr[k]);
		 }
		 if(!li1.contains(i))
		 {
			 System.out.println(i);
			 System.exit(0);
		 }
		
		 for(int k=0;k<=j;k++)
		 {
			if((li1.contains(i+k))&&(li1.contains(i-k)))
			 { 
				 continue;
			 }
           
			 if(!li1.contains(i-k))
			 {
				 System.out.println(i-k);
                 break;
				 
			 }
			 if(!li1.contains(i+k))
			 {
				 System.out.println(i+k);
                 break;
				 
			 }	 
		 }
		 
		 
	}
 
} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main{
	public static void main(String[] args)
	{
		 Scanner sc=new Scanner(System.in);
		 int i=sc.nextInt();
		 int j=sc.nextInt();
		 int arr[]=new int[j];
		 List li1=new ArrayList();
		 if(j==0)
		 {
			 System.out.println(i);
			 System.exit(0);
		 }
		 for(int k=0;k<j;k++)
		 {
			 arr[k]=sc.nextInt();
			 li1.add(arr[k]);
		 }
		 if(!li1.contains(i))
		 {
			 System.out.println(i);
			 System.exit(0);
		 }
		
		 for(int k=0;k<=j;k++)
		 {
			if((li1.contains(i+k))&&(li1.contains(i-k)))
			 { 
				 continue;
			 }
           
			 if(!li1.contains(i-k))
			 {
				 System.out.println(i-k);
                 break;
				 
			 }
			 if(!li1.contains(i+k))
			 {
				 System.out.println(i+k);
                 break;
				 
			 }	 
		 }
		 
		 
	}
 
}