import java.util.*;

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 sub = -100;
    if (n==0) {
      System.out.println(x);
      return;
    }	        	
    for (int i=x-n; i<x+n; i++) {	
      if ( Arrays.asList(p).contains(i))
        continue;
      if ( Math.abs(x-sub) > Math.abs(x-i) ){
        sub = i;
        continue;
      }
      if ( Math.abs(x-sub) < Math.abs(x-i))
        break;   
    }
    System.out.println(sub);
    sc.close();
  }
} import java.util.*; util.* java 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 sub = -100;
    if (n==0) {
      System.out.println(x);
      return;
    }	        	
    for (int i=x-n; i<x+n; i++) {	
      if ( Arrays.asList(p).contains(i))
        continue;
      if ( Math.abs(x-sub) > Math.abs(x-i) ){
        sub = i;
        continue;
      }
      if ( Math.abs(x-sub) < Math.abs(x-i))
        break;   
    }
    System.out.println(sub);
    sc.close();
  }
} 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 sub = -100;
    if (n==0) {
      System.out.println(x);
      return;
    }	        	
    for (int i=x-n; i<x+n; i++) {	
      if ( Arrays.asList(p).contains(i))
        continue;
      if ( Math.abs(x-sub) > Math.abs(x-i) ){
        sub = i;
        continue;
      }
      if ( Math.abs(x-sub) < Math.abs(x-i))
        break;   
    }
    System.out.println(sub);
    sc.close();
  } 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 sub = -100;
    if (n==0) {
      System.out.println(x);
      return;
    }	        	
    for (int i=x-n; i<x+n; i++) {	
      if ( Arrays.asList(p).contains(i))
        continue;
      if ( Math.abs(x-sub) > Math.abs(x-i) ){
        sub = i;
        continue;
      }
      if ( Math.abs(x-sub) < Math.abs(x-i))
        break;   
    }
    System.out.println(sub);
    sc.close();
  } 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 sub = -100; sub -100 100 if (n==0) {
      System.out.println(x);
      return;
    } n==0 n 0 {
      System.out.println(x);
      return;
    } System.out.println(x) System.out.println System.out System System.out x return; for (int i=x-n; i<x+n; i++) {	
      if ( Arrays.asList(p).contains(i))
        continue;
      if ( Math.abs(x-sub) > Math.abs(x-i) ){
        sub = i;
        continue;
      }
      if ( Math.abs(x-sub) < Math.abs(x-i))
        break;   
    } int i=x-n; int i=x-n; i x-n x n i<x+n i x+n x n i++ i++ i {	
      if ( Arrays.asList(p).contains(i))
        continue;
      if ( Math.abs(x-sub) > Math.abs(x-i) ){
        sub = i;
        continue;
      }
      if ( Math.abs(x-sub) < Math.abs(x-i))
        break;   
    } {	
      if ( Arrays.asList(p).contains(i))
        continue;
      if ( Math.abs(x-sub) > Math.abs(x-i) ){
        sub = i;
        continue;
      }
      if ( Math.abs(x-sub) < Math.abs(x-i))
        break;   
    } if ( Arrays.asList(p).contains(i))
        continue; Arrays.asList(p).contains(i) Arrays.asList(p).contains Arrays.asList(p) Arrays.asList Arrays p i continue; if ( Math.abs(x-sub) > Math.abs(x-i) ){
        sub = i;
        continue;
      } Math.abs(x-sub) > Math.abs(x-i) Math.abs(x-sub) Math.abs Math x-sub x sub Math.abs(x-i) Math.abs Math x-i x i {
        sub = i;
        continue;
      } sub = i sub i continue; if ( Math.abs(x-sub) < Math.abs(x-i))
        break; Math.abs(x-sub) < Math.abs(x-i) Math.abs(x-sub) Math.abs Math x-sub x sub Math.abs(x-i) Math.abs Math x-i x i break; System.out.println(sub) System.out.println System.out System System.out sub sc.close() sc.close sc String[] args args
import java.util.*;

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 sub = -100;
    if (n==0) {
      System.out.println(x);
      return;
    }	        	
    for (int i=x-n; i<x+n; i++) {	
      if ( Arrays.asList(p).contains(i))
        continue;
      if ( Math.abs(x-sub) > Math.abs(x-i) ){
        sub = i;
        continue;
      }
      if ( Math.abs(x-sub) < Math.abs(x-i))
        break;   
    }
    System.out.println(sub);
    sc.close();
  }
}