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();
    Integer[] p = new Integer[N];
    for(int i=0;i<N;i++){
      p[i] = sc.nextInt();
    }
    int i=0;
    int abs = 0;
    while(true){
      if(!(Arrays.asList(p).contains(X-i))){
        abs = -i;
        break;
      }else if(!(Arrays.asList(p).contains(X+i))){
        abs = i;
        break;
      }
      i++;
    }
    System.out.println(X+abs);
  }
} 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();
    Integer[] p = new Integer[N];
    for(int i=0;i<N;i++){
      p[i] = sc.nextInt();
    }
    int i=0;
    int abs = 0;
    while(true){
      if(!(Arrays.asList(p).contains(X-i))){
        abs = -i;
        break;
      }else if(!(Arrays.asList(p).contains(X+i))){
        abs = i;
        break;
      }
      i++;
    }
    System.out.println(X+abs);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int X = sc.nextInt();
    int N = sc.nextInt();
    Integer[] p = new Integer[N];
    for(int i=0;i<N;i++){
      p[i] = sc.nextInt();
    }
    int i=0;
    int abs = 0;
    while(true){
      if(!(Arrays.asList(p).contains(X-i))){
        abs = -i;
        break;
      }else if(!(Arrays.asList(p).contains(X+i))){
        abs = i;
        break;
      }
      i++;
    }
    System.out.println(X+abs);
  } main {
    Scanner sc = new Scanner(System.in);
    int X = sc.nextInt();
    int N = sc.nextInt();
    Integer[] p = new Integer[N];
    for(int i=0;i<N;i++){
      p[i] = sc.nextInt();
    }
    int i=0;
    int abs = 0;
    while(true){
      if(!(Arrays.asList(p).contains(X-i))){
        abs = -i;
        break;
      }else if(!(Arrays.asList(p).contains(X+i))){
        abs = i;
        break;
      }
      i++;
    }
    System.out.println(X+abs);
  } 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 Integer[] p = new Integer[N]; p new Integer[N] N for(int i=0;i<N;i++){
      p[i] = sc.nextInt();
    } int i=0; int i=0; i 0 i<N i N i++ i++ i {
      p[i] = sc.nextInt();
    } {
      p[i] = sc.nextInt();
    } p[i] = sc.nextInt() p[i] p i sc.nextInt() sc.nextInt sc int i=0; i 0 int abs = 0; abs 0 while(true){
      if(!(Arrays.asList(p).contains(X-i))){
        abs = -i;
        break;
      }else if(!(Arrays.asList(p).contains(X+i))){
        abs = i;
        break;
      }
      i++;
    } true {
      if(!(Arrays.asList(p).contains(X-i))){
        abs = -i;
        break;
      }else if(!(Arrays.asList(p).contains(X+i))){
        abs = i;
        break;
      }
      i++;
    } if(!(Arrays.asList(p).contains(X-i))){
        abs = -i;
        break;
      }else if(!(Arrays.asList(p).contains(X+i))){
        abs = i;
        break;
      } !(Arrays.asList(p).contains(X-i)) (Arrays.asList(p).contains(X-i)) Arrays.asList(p).contains Arrays.asList(p) Arrays.asList Arrays p X-i X i {
        abs = -i;
        break;
      } abs = -i abs -i i break; if(!(Arrays.asList(p).contains(X+i))){
        abs = i;
        break;
      } !(Arrays.asList(p).contains(X+i)) (Arrays.asList(p).contains(X+i)) Arrays.asList(p).contains Arrays.asList(p) Arrays.asList Arrays p X+i X i {
        abs = i;
        break;
      } abs = i abs i break; i++ i System.out.println(X+abs) System.out.println System.out System System.out X+abs X abs 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();
    Integer[] p = new Integer[N];
    for(int i=0;i<N;i++){
      p[i] = sc.nextInt();
    }
    int i=0;
    int abs = 0;
    while(true){
      if(!(Arrays.asList(p).contains(X-i))){
        abs = -i;
        break;
      }else if(!(Arrays.asList(p).contains(X+i))){
        abs = i;
        break;
      }
      i++;
    }
    System.out.println(X+abs);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int X = sc.nextInt();
    int N = sc.nextInt();
    Integer[] p = new Integer[N];
    for(int i=0;i<N;i++){
      p[i] = sc.nextInt();
    }
    int i=0;
    int abs = 0;
    while(true){
      if(!(Arrays.asList(p).contains(X-i))){
        abs = -i;
        break;
      }else if(!(Arrays.asList(p).contains(X+i))){
        abs = i;
        break;
      }
      i++;
    }
    System.out.println(X+abs);
  }
} 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();
    Integer[] p = new Integer[N];
    for(int i=0;i<N;i++){
      p[i] = sc.nextInt();
    }
    int i=0;
    int abs = 0;
    while(true){
      if(!(Arrays.asList(p).contains(X-i))){
        abs = -i;
        break;
      }else if(!(Arrays.asList(p).contains(X+i))){
        abs = i;
        break;
      }
      i++;
    }
    System.out.println(X+abs);
  }
}