import java.util.*;
import java.util.Arrays;
 
public class Main{
  public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int n = sc.nextInt();
    ArrayList<Integer> list = new ArrayList<>();
    for(int i = 0; i < n; i++){
         list.add(sc.nextInt());
    }
    
    if(n == 0){
      System.out.println(x);
      return;
    }else if(!list.contains(x)){
      System.out.println(x);
      return;
    }else{
 
      int i = 1;
      while(true){
        int a = x-i;
        int b = x+i;
        if(!list.contains(a)){
          System.out.println(a);
          return;
        }else if(!list.contains(b)){
          System.out.println(b);
          return;
        }else{
          i++;
        } 
      }
      
    }
    
  }
} import java.util.*; util.* java import java.util.Arrays; Arrays 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();
    ArrayList<Integer> list = new ArrayList<>();
    for(int i = 0; i < n; i++){
         list.add(sc.nextInt());
    }
    
    if(n == 0){
      System.out.println(x);
      return;
    }else if(!list.contains(x)){
      System.out.println(x);
      return;
    }else{
 
      int i = 1;
      while(true){
        int a = x-i;
        int b = x+i;
        if(!list.contains(a)){
          System.out.println(a);
          return;
        }else if(!list.contains(b)){
          System.out.println(b);
          return;
        }else{
          i++;
        } 
      }
      
    }
    
  }
} Main public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int n = sc.nextInt();
    ArrayList<Integer> list = new ArrayList<>();
    for(int i = 0; i < n; i++){
         list.add(sc.nextInt());
    }
    
    if(n == 0){
      System.out.println(x);
      return;
    }else if(!list.contains(x)){
      System.out.println(x);
      return;
    }else{
 
      int i = 1;
      while(true){
        int a = x-i;
        int b = x+i;
        if(!list.contains(a)){
          System.out.println(a);
          return;
        }else if(!list.contains(b)){
          System.out.println(b);
          return;
        }else{
          i++;
        } 
      }
      
    }
    
  } main {
    
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int n = sc.nextInt();
    ArrayList<Integer> list = new ArrayList<>();
    for(int i = 0; i < n; i++){
         list.add(sc.nextInt());
    }
    
    if(n == 0){
      System.out.println(x);
      return;
    }else if(!list.contains(x)){
      System.out.println(x);
      return;
    }else{
 
      int i = 1;
      while(true){
        int a = x-i;
        int b = x+i;
        if(!list.contains(a)){
          System.out.println(a);
          return;
        }else if(!list.contains(b)){
          System.out.println(b);
          return;
        }else{
          i++;
        } 
      }
      
    }
    
  } 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 ArrayList<Integer> list = new ArrayList<>(); list new ArrayList<>() for(int i = 0; i < n; i++){
         list.add(sc.nextInt());
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
         list.add(sc.nextInt());
    } {
         list.add(sc.nextInt());
    } list.add(sc.nextInt()) list.add list sc.nextInt() sc.nextInt sc if(n == 0){
      System.out.println(x);
      return;
    }else if(!list.contains(x)){
      System.out.println(x);
      return;
    }else{
 
      int i = 1;
      while(true){
        int a = x-i;
        int b = x+i;
        if(!list.contains(a)){
          System.out.println(a);
          return;
        }else if(!list.contains(b)){
          System.out.println(b);
          return;
        }else{
          i++;
        } 
      }
      
    } n == 0 n 0 {
      System.out.println(x);
      return;
    } System.out.println(x) System.out.println System.out System System.out x return; if(!list.contains(x)){
      System.out.println(x);
      return;
    }else{
 
      int i = 1;
      while(true){
        int a = x-i;
        int b = x+i;
        if(!list.contains(a)){
          System.out.println(a);
          return;
        }else if(!list.contains(b)){
          System.out.println(b);
          return;
        }else{
          i++;
        } 
      }
      
    } !list.contains(x) list.contains(x) list.contains list x {
      System.out.println(x);
      return;
    } System.out.println(x) System.out.println System.out System System.out x return; {
 
      int i = 1;
      while(true){
        int a = x-i;
        int b = x+i;
        if(!list.contains(a)){
          System.out.println(a);
          return;
        }else if(!list.contains(b)){
          System.out.println(b);
          return;
        }else{
          i++;
        } 
      }
      
    } int i = 1; i 1 while(true){
        int a = x-i;
        int b = x+i;
        if(!list.contains(a)){
          System.out.println(a);
          return;
        }else if(!list.contains(b)){
          System.out.println(b);
          return;
        }else{
          i++;
        } 
      } true {
        int a = x-i;
        int b = x+i;
        if(!list.contains(a)){
          System.out.println(a);
          return;
        }else if(!list.contains(b)){
          System.out.println(b);
          return;
        }else{
          i++;
        } 
      } int a = x-i; a x-i x i int b = x+i; b x+i x i if(!list.contains(a)){
          System.out.println(a);
          return;
        }else if(!list.contains(b)){
          System.out.println(b);
          return;
        }else{
          i++;
        } !list.contains(a) list.contains(a) list.contains list a {
          System.out.println(a);
          return;
        } System.out.println(a) System.out.println System.out System System.out a return; if(!list.contains(b)){
          System.out.println(b);
          return;
        }else{
          i++;
        } !list.contains(b) list.contains(b) list.contains list b {
          System.out.println(b);
          return;
        } System.out.println(b) System.out.println System.out System System.out b return; {
          i++;
        } i++ i 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();
    ArrayList<Integer> list = new ArrayList<>();
    for(int i = 0; i < n; i++){
         list.add(sc.nextInt());
    }
    
    if(n == 0){
      System.out.println(x);
      return;
    }else if(!list.contains(x)){
      System.out.println(x);
      return;
    }else{
 
      int i = 1;
      while(true){
        int a = x-i;
        int b = x+i;
        if(!list.contains(a)){
          System.out.println(a);
          return;
        }else if(!list.contains(b)){
          System.out.println(b);
          return;
        }else{
          i++;
        } 
      }
      
    }
    
  }
} public class Main{
  public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int n = sc.nextInt();
    ArrayList<Integer> list = new ArrayList<>();
    for(int i = 0; i < n; i++){
         list.add(sc.nextInt());
    }
    
    if(n == 0){
      System.out.println(x);
      return;
    }else if(!list.contains(x)){
      System.out.println(x);
      return;
    }else{
 
      int i = 1;
      while(true){
        int a = x-i;
        int b = x+i;
        if(!list.contains(a)){
          System.out.println(a);
          return;
        }else if(!list.contains(b)){
          System.out.println(b);
          return;
        }else{
          i++;
        } 
      }
      
    }
    
  }
} Main
import java.util.*;
import java.util.Arrays;
 
public class Main{
  public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int n = sc.nextInt();
    ArrayList<Integer> list = new ArrayList<>();
    for(int i = 0; i < n; i++){
         list.add(sc.nextInt());
    }
    
    if(n == 0){
      System.out.println(x);
      return;
    }else if(!list.contains(x)){
      System.out.println(x);
      return;
    }else{
 
      int i = 1;
      while(true){
        int a = x-i;
        int b = x+i;
        if(!list.contains(a)){
          System.out.println(a);
          return;
        }else if(!list.contains(b)){
          System.out.println(b);
          return;
        }else{
          i++;
        } 
      }
      
    }
    
  }
}