import java.util.ArrayList;
import java.util.List;
import java.util.Collections;
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> list = new ArrayList<>();
    int x = sc.nextInt();
    int n = sc.nextInt();
    for(int i=0; i<n; i++){
       list.add(sc.nextInt());
    }

    Collections.sort(list);


    int i = 0;
    int ans = 0;
    while(true){
      if(!(list.contains(x-i))){
        ans = x-i;
        break;
      }

      // for(int j=0; j<list.size(); j++){
      //   System.out.println("*"+list.get(j));
      // }
      if(!(list.contains(x+i))){
        ans = x+i;
        break;
      }
      i++;
    }
    System.out.println(ans);

    //for(int i=0; i<list.size(); i++){
      //System.out.println(list.get(i));
    //}

  }

} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Collections; Collections java.util import java.util.Scanner; Scanner java.util public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> list = new ArrayList<>();
    int x = sc.nextInt();
    int n = sc.nextInt();
    for(int i=0; i<n; i++){
       list.add(sc.nextInt());
    }

    Collections.sort(list);


    int i = 0;
    int ans = 0;
    while(true){
      if(!(list.contains(x-i))){
        ans = x-i;
        break;
      }

      // for(int j=0; j<list.size(); j++){
      //   System.out.println("*"+list.get(j));
      // }
      if(!(list.contains(x+i))){
        ans = x+i;
        break;
      }
      i++;
    }
    System.out.println(ans);

    //for(int i=0; i<list.size(); i++){
      //System.out.println(list.get(i));
    //}

  }

} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> list = new ArrayList<>();
    int x = sc.nextInt();
    int n = sc.nextInt();
    for(int i=0; i<n; i++){
       list.add(sc.nextInt());
    }

    Collections.sort(list);


    int i = 0;
    int ans = 0;
    while(true){
      if(!(list.contains(x-i))){
        ans = x-i;
        break;
      }

      // for(int j=0; j<list.size(); j++){
      //   System.out.println("*"+list.get(j));
      // }
      if(!(list.contains(x+i))){
        ans = x+i;
        break;
      }
      i++;
    }
    System.out.println(ans);

    //for(int i=0; i<list.size(); i++){
      //System.out.println(list.get(i));
    //}

  } main {
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> list = new ArrayList<>();
    int x = sc.nextInt();
    int n = sc.nextInt();
    for(int i=0; i<n; i++){
       list.add(sc.nextInt());
    }

    Collections.sort(list);


    int i = 0;
    int ans = 0;
    while(true){
      if(!(list.contains(x-i))){
        ans = x-i;
        break;
      }

      // for(int j=0; j<list.size(); j++){
      //   System.out.println("*"+list.get(j));
      // }
      if(!(list.contains(x+i))){
        ans = x+i;
        break;
      }
      i++;
    }
    System.out.println(ans);

    //for(int i=0; i<list.size(); i++){
      //System.out.println(list.get(i));
    //}

  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) ArrayList<Integer> list = new ArrayList<>(); list new ArrayList<>() int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc 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 Collections.sort(list) Collections.sort Collections list int i = 0; i 0 int ans = 0; ans 0 while(true){
      if(!(list.contains(x-i))){
        ans = x-i;
        break;
      }

      // for(int j=0; j<list.size(); j++){
      //   System.out.println("*"+list.get(j));
      // }
      if(!(list.contains(x+i))){
        ans = x+i;
        break;
      }
      i++;
    } true {
      if(!(list.contains(x-i))){
        ans = x-i;
        break;
      }

      // for(int j=0; j<list.size(); j++){
      //   System.out.println("*"+list.get(j));
      // }
      if(!(list.contains(x+i))){
        ans = x+i;
        break;
      }
      i++;
    } if(!(list.contains(x-i))){
        ans = x-i;
        break;
      } !(list.contains(x-i)) (list.contains(x-i)) list.contains list x-i x i {
        ans = x-i;
        break;
      } ans = x-i ans x-i x i break; if(!(list.contains(x+i))){
        ans = x+i;
        break;
      } !(list.contains(x+i)) (list.contains(x+i)) list.contains list x+i x i {
        ans = x+i;
        break;
      } ans = x+i ans x+i x i break; i++ i 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);
    ArrayList<Integer> list = new ArrayList<>();
    int x = sc.nextInt();
    int n = sc.nextInt();
    for(int i=0; i<n; i++){
       list.add(sc.nextInt());
    }

    Collections.sort(list);


    int i = 0;
    int ans = 0;
    while(true){
      if(!(list.contains(x-i))){
        ans = x-i;
        break;
      }

      // for(int j=0; j<list.size(); j++){
      //   System.out.println("*"+list.get(j));
      // }
      if(!(list.contains(x+i))){
        ans = x+i;
        break;
      }
      i++;
    }
    System.out.println(ans);

    //for(int i=0; i<list.size(); i++){
      //System.out.println(list.get(i));
    //}

  }

} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> list = new ArrayList<>();
    int x = sc.nextInt();
    int n = sc.nextInt();
    for(int i=0; i<n; i++){
       list.add(sc.nextInt());
    }

    Collections.sort(list);


    int i = 0;
    int ans = 0;
    while(true){
      if(!(list.contains(x-i))){
        ans = x-i;
        break;
      }

      // for(int j=0; j<list.size(); j++){
      //   System.out.println("*"+list.get(j));
      // }
      if(!(list.contains(x+i))){
        ans = x+i;
        break;
      }
      i++;
    }
    System.out.println(ans);

    //for(int i=0; i<list.size(); i++){
      //System.out.println(list.get(i));
    //}

  }

} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Collections;
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> list = new ArrayList<>();
    int x = sc.nextInt();
    int n = sc.nextInt();
    for(int i=0; i<n; i++){
       list.add(sc.nextInt());
    }

    Collections.sort(list);


    int i = 0;
    int ans = 0;
    while(true){
      if(!(list.contains(x-i))){
        ans = x-i;
        break;
      }

      // for(int j=0; j<list.size(); j++){
      //   System.out.println("*"+list.get(j));
      // }
      if(!(list.contains(x+i))){
        ans = x+i;
        break;
      }
      i++;
    }
    System.out.println(ans);

    //for(int i=0; i<list.size(); i++){
      //System.out.println(list.get(i));
    //}

  }

}