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> list = new ArrayList<Integer>();
    for(int i = 0; i < n; i++) {
      list.add(sc.nextInt());
    }
    int a = x;
    int b = x;
    for(int i = x; i >= x - 200; i--) {
      if(!list.contains(i)) {
        a = i;
        break;        
      }
    }
    for(int i = x; i <= x + 200; i++) {
      if(!list.contains(i)) {
        b = i;
        break;        
      }
    }
    int ans = a;
    if(Math.abs(a - x) > Math.abs(b - x)) ans = b;
    System.out.println(ans);
  }
} 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> list = new ArrayList<Integer>();
    for(int i = 0; i < n; i++) {
      list.add(sc.nextInt());
    }
    int a = x;
    int b = x;
    for(int i = x; i >= x - 200; i--) {
      if(!list.contains(i)) {
        a = i;
        break;        
      }
    }
    for(int i = x; i <= x + 200; i++) {
      if(!list.contains(i)) {
        b = i;
        break;        
      }
    }
    int ans = a;
    if(Math.abs(a - x) > Math.abs(b - x)) ans = b;
    System.out.println(ans);
  }
} 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<Integer>();
    for(int i = 0; i < n; i++) {
      list.add(sc.nextInt());
    }
    int a = x;
    int b = x;
    for(int i = x; i >= x - 200; i--) {
      if(!list.contains(i)) {
        a = i;
        break;        
      }
    }
    for(int i = x; i <= x + 200; i++) {
      if(!list.contains(i)) {
        b = i;
        break;        
      }
    }
    int ans = a;
    if(Math.abs(a - x) > Math.abs(b - x)) ans = b;
    System.out.println(ans);
  } main {
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int n = sc.nextInt();
    ArrayList<Integer> list = new ArrayList<Integer>();
    for(int i = 0; i < n; i++) {
      list.add(sc.nextInt());
    }
    int a = x;
    int b = x;
    for(int i = x; i >= x - 200; i--) {
      if(!list.contains(i)) {
        a = i;
        break;        
      }
    }
    for(int i = x; i <= x + 200; i++) {
      if(!list.contains(i)) {
        b = i;
        break;        
      }
    }
    int ans = a;
    if(Math.abs(a - x) > Math.abs(b - x)) ans = b;
    System.out.println(ans);
  } 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<Integer>(); list new ArrayList<Integer>() 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 int a = x; a x int b = x; b x for(int i = x; i >= x - 200; i--) {
      if(!list.contains(i)) {
        a = i;
        break;        
      }
    } int i = x; int i = x; i x i >= x - 200 i x - 200 x 200 i-- i-- i {
      if(!list.contains(i)) {
        a = i;
        break;        
      }
    } {
      if(!list.contains(i)) {
        a = i;
        break;        
      }
    } if(!list.contains(i)) {
        a = i;
        break;        
      } !list.contains(i) list.contains(i) list.contains list i {
        a = i;
        break;        
      } a = i a i break; for(int i = x; i <= x + 200; i++) {
      if(!list.contains(i)) {
        b = i;
        break;        
      }
    } int i = x; int i = x; i x i <= x + 200 i x + 200 x 200 i++ i++ i {
      if(!list.contains(i)) {
        b = i;
        break;        
      }
    } {
      if(!list.contains(i)) {
        b = i;
        break;        
      }
    } if(!list.contains(i)) {
        b = i;
        break;        
      } !list.contains(i) list.contains(i) list.contains list i {
        b = i;
        break;        
      } b = i b i break; int ans = a; ans a if(Math.abs(a - x) > Math.abs(b - x)) ans = b; Math.abs(a - x) > Math.abs(b - x) Math.abs(a - x) Math.abs Math a - x a x Math.abs(b - x) Math.abs Math b - x b x ans = b ans b 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);
    int x = sc.nextInt();
    int n = sc.nextInt();
    ArrayList<Integer> list = new ArrayList<Integer>();
    for(int i = 0; i < n; i++) {
      list.add(sc.nextInt());
    }
    int a = x;
    int b = x;
    for(int i = x; i >= x - 200; i--) {
      if(!list.contains(i)) {
        a = i;
        break;        
      }
    }
    for(int i = x; i <= x + 200; i++) {
      if(!list.contains(i)) {
        b = i;
        break;        
      }
    }
    int ans = a;
    if(Math.abs(a - x) > Math.abs(b - x)) ans = b;
    System.out.println(ans);
  }
} 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<Integer>();
    for(int i = 0; i < n; i++) {
      list.add(sc.nextInt());
    }
    int a = x;
    int b = x;
    for(int i = x; i >= x - 200; i--) {
      if(!list.contains(i)) {
        a = i;
        break;        
      }
    }
    for(int i = x; i <= x + 200; i++) {
      if(!list.contains(i)) {
        b = i;
        break;        
      }
    }
    int ans = a;
    if(Math.abs(a - x) > Math.abs(b - x)) ans = b;
    System.out.println(ans);
  }
} 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> list = new ArrayList<Integer>();
    for(int i = 0; i < n; i++) {
      list.add(sc.nextInt());
    }
    int a = x;
    int b = x;
    for(int i = x; i >= x - 200; i--) {
      if(!list.contains(i)) {
        a = i;
        break;        
      }
    }
    for(int i = x; i <= x + 200; i++) {
      if(!list.contains(i)) {
        b = i;
        break;        
      }
    }
    int ans = a;
    if(Math.abs(a - x) > Math.abs(b - x)) ans = b;
    System.out.println(ans);
  }
}