import java.util.*;
class Main
{
  public static void main(String [] args)
  {
    Scanner s = new Scanner(System.in);
   int num = s.nextInt();
    int n = s.nextInt();
    
    HashSet<Integer>h = new HashSet<>();
    
   	for(int i = 0; i < n;i++)
      h.add(s.nextInt());
    
    int count = 0;
    boolean found = false;
    int prev = 0;
    
    while(!found)
    {
      if(!(h.contains(num - count))) found = true;
      prev = count; 
      if(count > 0)
           count = 0 - count;
      else
           count = 0 - count + 1;
     
    }
           
    System.out.println(num - prev);
                          
  }
} import java.util.*; util.* java class Main
{
  public static void main(String [] args)
  {
    Scanner s = new Scanner(System.in);
   int num = s.nextInt();
    int n = s.nextInt();
    
    HashSet<Integer>h = new HashSet<>();
    
   	for(int i = 0; i < n;i++)
      h.add(s.nextInt());
    
    int count = 0;
    boolean found = false;
    int prev = 0;
    
    while(!found)
    {
      if(!(h.contains(num - count))) found = true;
      prev = count; 
      if(count > 0)
           count = 0 - count;
      else
           count = 0 - count + 1;
     
    }
           
    System.out.println(num - prev);
                          
  }
} Main public static void main(String [] args)
  {
    Scanner s = new Scanner(System.in);
   int num = s.nextInt();
    int n = s.nextInt();
    
    HashSet<Integer>h = new HashSet<>();
    
   	for(int i = 0; i < n;i++)
      h.add(s.nextInt());
    
    int count = 0;
    boolean found = false;
    int prev = 0;
    
    while(!found)
    {
      if(!(h.contains(num - count))) found = true;
      prev = count; 
      if(count > 0)
           count = 0 - count;
      else
           count = 0 - count + 1;
     
    }
           
    System.out.println(num - prev);
                          
  } main {
    Scanner s = new Scanner(System.in);
   int num = s.nextInt();
    int n = s.nextInt();
    
    HashSet<Integer>h = new HashSet<>();
    
   	for(int i = 0; i < n;i++)
      h.add(s.nextInt());
    
    int count = 0;
    boolean found = false;
    int prev = 0;
    
    while(!found)
    {
      if(!(h.contains(num - count))) found = true;
      prev = count; 
      if(count > 0)
           count = 0 - count;
      else
           count = 0 - count + 1;
     
    }
           
    System.out.println(num - prev);
                          
  } Scanner s = new Scanner(System.in); s new Scanner(System.in) int num = s.nextInt(); num s.nextInt() s.nextInt s int n = s.nextInt(); n s.nextInt() s.nextInt s HashSet<Integer>h = new HashSet<>(); h new HashSet<>() for(int i = 0; i < n;i++)
      h.add(s.nextInt()); int i = 0; int i = 0; i 0 i < n i n i++ i++ i h.add(s.nextInt()); h.add(s.nextInt()) h.add h s.nextInt() s.nextInt s int count = 0; count 0 boolean found = false; found false int prev = 0; prev 0 while(!found)
    {
      if(!(h.contains(num - count))) found = true;
      prev = count; 
      if(count > 0)
           count = 0 - count;
      else
           count = 0 - count + 1;
     
    } !found found {
      if(!(h.contains(num - count))) found = true;
      prev = count; 
      if(count > 0)
           count = 0 - count;
      else
           count = 0 - count + 1;
     
    } if(!(h.contains(num - count))) found = true; !(h.contains(num - count)) (h.contains(num - count)) h.contains h num - count num count found = true found true prev = count prev count if(count > 0)
           count = 0 - count;
      else
           count = 0 - count + 1; count > 0 count 0 count = 0 - count count 0 - count 0 count count = 0 - count + 1 count 0 - count + 1 0 - count 0 count 1 System.out.println(num - prev) System.out.println System.out System System.out num - prev num prev String [] args args
import java.util.*;
class Main
{
  public static void main(String [] args)
  {
    Scanner s = new Scanner(System.in);
   int num = s.nextInt();
    int n = s.nextInt();
    
    HashSet<Integer>h = new HashSet<>();
    
   	for(int i = 0; i < n;i++)
      h.add(s.nextInt());
    
    int count = 0;
    boolean found = false;
    int prev = 0;
    
    while(!found)
    {
      if(!(h.contains(num - count))) found = true;
      prev = count; 
      if(count > 0)
           count = 0 - count;
      else
           count = 0 - count + 1;
     
    }
           
    System.out.println(num - prev);
                          
  }
}