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();
    ArrayList<Integer> pList = new ArrayList<Integer>();
    for (int i=0; i<n; i++) {
      pList.add(sc.nextInt());
    }
    // Arrays.sort(pList);
    
    int number;
    for (int i=0; ; i++) {
      number = x - i;
      if (!pList.contains(number)) {
        System.out.println(number);
        return;
      }
      number = x + i;
      if (!pList.contains(number)) {
        System.out.println(number);
        return;
      }
    }
  }
} 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();
    ArrayList<Integer> pList = new ArrayList<Integer>();
    for (int i=0; i<n; i++) {
      pList.add(sc.nextInt());
    }
    // Arrays.sort(pList);
    
    int number;
    for (int i=0; ; i++) {
      number = x - i;
      if (!pList.contains(number)) {
        System.out.println(number);
        return;
      }
      number = x + i;
      if (!pList.contains(number)) {
        System.out.println(number);
        return;
      }
    }
  }
} Main public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int n = sc.nextInt();
    ArrayList<Integer> pList = new ArrayList<Integer>();
    for (int i=0; i<n; i++) {
      pList.add(sc.nextInt());
    }
    // Arrays.sort(pList);
    
    int number;
    for (int i=0; ; i++) {
      number = x - i;
      if (!pList.contains(number)) {
        System.out.println(number);
        return;
      }
      number = x + i;
      if (!pList.contains(number)) {
        System.out.println(number);
        return;
      }
    }
  } main {

    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int n = sc.nextInt();
    ArrayList<Integer> pList = new ArrayList<Integer>();
    for (int i=0; i<n; i++) {
      pList.add(sc.nextInt());
    }
    // Arrays.sort(pList);
    
    int number;
    for (int i=0; ; i++) {
      number = x - i;
      if (!pList.contains(number)) {
        System.out.println(number);
        return;
      }
      number = x + i;
      if (!pList.contains(number)) {
        System.out.println(number);
        return;
      }
    }
  } 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> pList = new ArrayList<Integer>(); pList new ArrayList<Integer>() for (int i=0; i<n; i++) {
      pList.add(sc.nextInt());
    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
      pList.add(sc.nextInt());
    } {
      pList.add(sc.nextInt());
    } pList.add(sc.nextInt()) pList.add pList sc.nextInt() sc.nextInt sc int number; number for (int i=0; ; i++) {
      number = x - i;
      if (!pList.contains(number)) {
        System.out.println(number);
        return;
      }
      number = x + i;
      if (!pList.contains(number)) {
        System.out.println(number);
        return;
      }
    } int i=0; int i=0; i 0 i++ i++ i {
      number = x - i;
      if (!pList.contains(number)) {
        System.out.println(number);
        return;
      }
      number = x + i;
      if (!pList.contains(number)) {
        System.out.println(number);
        return;
      }
    } {
      number = x - i;
      if (!pList.contains(number)) {
        System.out.println(number);
        return;
      }
      number = x + i;
      if (!pList.contains(number)) {
        System.out.println(number);
        return;
      }
    } number = x - i number x - i x i if (!pList.contains(number)) {
        System.out.println(number);
        return;
      } !pList.contains(number) pList.contains(number) pList.contains pList number {
        System.out.println(number);
        return;
      } System.out.println(number) System.out.println System.out System System.out number return; number = x + i number x + i x i if (!pList.contains(number)) {
        System.out.println(number);
        return;
      } !pList.contains(number) pList.contains(number) pList.contains pList number {
        System.out.println(number);
        return;
      } System.out.println(number) System.out.println System.out System System.out number return; 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> pList = new ArrayList<Integer>();
    for (int i=0; i<n; i++) {
      pList.add(sc.nextInt());
    }
    // Arrays.sort(pList);
    
    int number;
    for (int i=0; ; i++) {
      number = x - i;
      if (!pList.contains(number)) {
        System.out.println(number);
        return;
      }
      number = x + i;
      if (!pList.contains(number)) {
        System.out.println(number);
        return;
      }
    }
  }
} 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> pList = new ArrayList<Integer>();
    for (int i=0; i<n; i++) {
      pList.add(sc.nextInt());
    }
    // Arrays.sort(pList);
    
    int number;
    for (int i=0; ; i++) {
      number = x - i;
      if (!pList.contains(number)) {
        System.out.println(number);
        return;
      }
      number = x + i;
      if (!pList.contains(number)) {
        System.out.println(number);
        return;
      }
    }
  }
} 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();
    ArrayList<Integer> pList = new ArrayList<Integer>();
    for (int i=0; i<n; i++) {
      pList.add(sc.nextInt());
    }
    // Arrays.sort(pList);
    
    int number;
    for (int i=0; ; i++) {
      number = x - i;
      if (!pList.contains(number)) {
        System.out.println(number);
        return;
      }
      number = x + i;
      if (!pList.contains(number)) {
        System.out.println(number);
        return;
      }
    }
  }
}
