import java.util.*;

public class Main{
public static void main(String[] args)
{ 
  Scanner sc=new Scanner(System.in);
  int x=sc.nextInt();
  int n=sc.nextInt();
  Set<Integer> set =new HashSet<>();
  for(int i=0;i<n;i++)
    set.add(sc.nextInt());
  int ans=x;
  for(int i=x,j=x;;i++,j--)
  {  if(!set.contains(i))
    { ans=i;
     break;}
   
   else if(!set.contains(j-1))
    {ans=j-1;
      break;}
    
    else if(!set.contains(i+1))
    { ans=i+1;
     break;}
    
  }

  System.out.println(ans);
}
 
} import java.util.*; util.* java public class Main{
public static void main(String[] args)
{ 
  Scanner sc=new Scanner(System.in);
  int x=sc.nextInt();
  int n=sc.nextInt();
  Set<Integer> set =new HashSet<>();
  for(int i=0;i<n;i++)
    set.add(sc.nextInt());
  int ans=x;
  for(int i=x,j=x;;i++,j--)
  {  if(!set.contains(i))
    { ans=i;
     break;}
   
   else if(!set.contains(j-1))
    {ans=j-1;
      break;}
    
    else if(!set.contains(i+1))
    { ans=i+1;
     break;}
    
  }

  System.out.println(ans);
}
 
} Main public static void main(String[] args)
{ 
  Scanner sc=new Scanner(System.in);
  int x=sc.nextInt();
  int n=sc.nextInt();
  Set<Integer> set =new HashSet<>();
  for(int i=0;i<n;i++)
    set.add(sc.nextInt());
  int ans=x;
  for(int i=x,j=x;;i++,j--)
  {  if(!set.contains(i))
    { ans=i;
     break;}
   
   else if(!set.contains(j-1))
    {ans=j-1;
      break;}
    
    else if(!set.contains(i+1))
    { ans=i+1;
     break;}
    
  }

  System.out.println(ans);
} main { 
  Scanner sc=new Scanner(System.in);
  int x=sc.nextInt();
  int n=sc.nextInt();
  Set<Integer> set =new HashSet<>();
  for(int i=0;i<n;i++)
    set.add(sc.nextInt());
  int ans=x;
  for(int i=x,j=x;;i++,j--)
  {  if(!set.contains(i))
    { ans=i;
     break;}
   
   else if(!set.contains(j-1))
    {ans=j-1;
      break;}
    
    else if(!set.contains(i+1))
    { ans=i+1;
     break;}
    
  }

  System.out.println(ans);
} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int x=sc.nextInt(); x sc.nextInt() sc.nextInt sc int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc Set<Integer> set =new HashSet<>(); set new HashSet<>() for(int i=0;i<n;i++)
    set.add(sc.nextInt()); int i=0; int i=0; i 0 i<n i n i++ i++ i set.add(sc.nextInt()); set.add(sc.nextInt()) set.add set sc.nextInt() sc.nextInt sc int ans=x; ans x for(int i=x,j=x;;i++,j--)
  {  if(!set.contains(i))
    { ans=i;
     break;}
   
   else if(!set.contains(j-1))
    {ans=j-1;
      break;}
    
    else if(!set.contains(i+1))
    { ans=i+1;
     break;}
    
  } int i=x,j=x; int i=x i x j=x; j x i++,j-- i++ i j-- j {  if(!set.contains(i))
    { ans=i;
     break;}
   
   else if(!set.contains(j-1))
    {ans=j-1;
      break;}
    
    else if(!set.contains(i+1))
    { ans=i+1;
     break;}
    
  } {  if(!set.contains(i))
    { ans=i;
     break;}
   
   else if(!set.contains(j-1))
    {ans=j-1;
      break;}
    
    else if(!set.contains(i+1))
    { ans=i+1;
     break;}
    
  } if(!set.contains(i))
    { ans=i;
     break;}
   
   else if(!set.contains(j-1))
    {ans=j-1;
      break;}
    
    else if(!set.contains(i+1))
    { ans=i+1;
     break;} !set.contains(i) set.contains(i) set.contains set i { ans=i;
     break;} ans=i ans i break; if(!set.contains(j-1))
    {ans=j-1;
      break;}
    
    else if(!set.contains(i+1))
    { ans=i+1;
     break;} !set.contains(j-1) set.contains(j-1) set.contains set j-1 j 1 {ans=j-1;
      break;} ans=j-1 ans j-1 j 1 break; if(!set.contains(i+1))
    { ans=i+1;
     break;} !set.contains(i+1) set.contains(i+1) set.contains set i+1 i 1 { ans=i+1;
     break;} ans=i+1 ans i+1 i 1 break; System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main{
public static void main(String[] args)
{ 
  Scanner sc=new Scanner(System.in);
  int x=sc.nextInt();
  int n=sc.nextInt();
  Set<Integer> set =new HashSet<>();
  for(int i=0;i<n;i++)
    set.add(sc.nextInt());
  int ans=x;
  for(int i=x,j=x;;i++,j--)
  {  if(!set.contains(i))
    { ans=i;
     break;}
   
   else if(!set.contains(j-1))
    {ans=j-1;
      break;}
    
    else if(!set.contains(i+1))
    { ans=i+1;
     break;}
    
  }

  System.out.println(ans);
}
 
} public class Main{
public static void main(String[] args)
{ 
  Scanner sc=new Scanner(System.in);
  int x=sc.nextInt();
  int n=sc.nextInt();
  Set<Integer> set =new HashSet<>();
  for(int i=0;i<n;i++)
    set.add(sc.nextInt());
  int ans=x;
  for(int i=x,j=x;;i++,j--)
  {  if(!set.contains(i))
    { ans=i;
     break;}
   
   else if(!set.contains(j-1))
    {ans=j-1;
      break;}
    
    else if(!set.contains(i+1))
    { ans=i+1;
     break;}
    
  }

  System.out.println(ans);
}
 
} Main
import java.util.*;

public class Main{
public static void main(String[] args)
{ 
  Scanner sc=new Scanner(System.in);
  int x=sc.nextInt();
  int n=sc.nextInt();
  Set<Integer> set =new HashSet<>();
  for(int i=0;i<n;i++)
    set.add(sc.nextInt());
  int ans=x;
  for(int i=x,j=x;;i++,j--)
  {  if(!set.contains(i))
    { ans=i;
     break;}
   
   else if(!set.contains(j-1))
    {ans=j-1;
      break;}
    
    else if(!set.contains(i+1))
    { ans=i+1;
     break;}
    
  }

  System.out.println(ans);
}
 
}
