import java.util.*;

public class Main{
	
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	int x=sc.nextInt(),n=sc.nextInt(),min=301;
    int[] p=new int[n],a=new int[300-n];
    
    
    for(int i=0;i<n;i++){
      p[i]=sc.nextInt();
      
    }
    int l=0;
    for(int i=-150;i<150;i++){
      int f=0;
      for(int j=0;j<n;j++){
        if(i==p[j]){
          f++;
          break;
        }
      }
      if(f==0){
        a[l]=i;
        l++;
      }
    }
    
    if(n==0){
      System.out.println(x);
    }else{
      for(int i=0;i<a.length;i++){
        if(min<=(int)Math.abs(x-a[i])){
          System.out.println(a[i-1]);
          break;
        }else{
          min=(int)Math.abs(x-a[i]);
        }
      }
    }
  }
} import java.util.*; util.* java public class Main{
	
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	int x=sc.nextInt(),n=sc.nextInt(),min=301;
    int[] p=new int[n],a=new int[300-n];
    
    
    for(int i=0;i<n;i++){
      p[i]=sc.nextInt();
      
    }
    int l=0;
    for(int i=-150;i<150;i++){
      int f=0;
      for(int j=0;j<n;j++){
        if(i==p[j]){
          f++;
          break;
        }
      }
      if(f==0){
        a[l]=i;
        l++;
      }
    }
    
    if(n==0){
      System.out.println(x);
    }else{
      for(int i=0;i<a.length;i++){
        if(min<=(int)Math.abs(x-a[i])){
          System.out.println(a[i-1]);
          break;
        }else{
          min=(int)Math.abs(x-a[i]);
        }
      }
    }
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	int x=sc.nextInt(),n=sc.nextInt(),min=301;
    int[] p=new int[n],a=new int[300-n];
    
    
    for(int i=0;i<n;i++){
      p[i]=sc.nextInt();
      
    }
    int l=0;
    for(int i=-150;i<150;i++){
      int f=0;
      for(int j=0;j<n;j++){
        if(i==p[j]){
          f++;
          break;
        }
      }
      if(f==0){
        a[l]=i;
        l++;
      }
    }
    
    if(n==0){
      System.out.println(x);
    }else{
      for(int i=0;i<a.length;i++){
        if(min<=(int)Math.abs(x-a[i])){
          System.out.println(a[i-1]);
          break;
        }else{
          min=(int)Math.abs(x-a[i]);
        }
      }
    }
  } main {
    Scanner sc = new Scanner(System.in);
  	int x=sc.nextInt(),n=sc.nextInt(),min=301;
    int[] p=new int[n],a=new int[300-n];
    
    
    for(int i=0;i<n;i++){
      p[i]=sc.nextInt();
      
    }
    int l=0;
    for(int i=-150;i<150;i++){
      int f=0;
      for(int j=0;j<n;j++){
        if(i==p[j]){
          f++;
          break;
        }
      }
      if(f==0){
        a[l]=i;
        l++;
      }
    }
    
    if(n==0){
      System.out.println(x);
    }else{
      for(int i=0;i<a.length;i++){
        if(min<=(int)Math.abs(x-a[i])){
          System.out.println(a[i-1]);
          break;
        }else{
          min=(int)Math.abs(x-a[i]);
        }
      }
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x=sc.nextInt() x sc.nextInt() sc.nextInt sc n=sc.nextInt() n sc.nextInt() sc.nextInt sc min=301; min 301 int[] p=new int[n] p new int[n] n a=new int[300-n]; a new int[300-n] 300-n 300 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 l=0; l 0 for(int i=-150;i<150;i++){
      int f=0;
      for(int j=0;j<n;j++){
        if(i==p[j]){
          f++;
          break;
        }
      }
      if(f==0){
        a[l]=i;
        l++;
      }
    } int i=-150; int i=-150; i -150 150 i<150 i 150 i++ i++ i {
      int f=0;
      for(int j=0;j<n;j++){
        if(i==p[j]){
          f++;
          break;
        }
      }
      if(f==0){
        a[l]=i;
        l++;
      }
    } {
      int f=0;
      for(int j=0;j<n;j++){
        if(i==p[j]){
          f++;
          break;
        }
      }
      if(f==0){
        a[l]=i;
        l++;
      }
    } int f=0; f 0 for(int j=0;j<n;j++){
        if(i==p[j]){
          f++;
          break;
        }
      } int j=0; int j=0; j 0 j<n j n j++ j++ j {
        if(i==p[j]){
          f++;
          break;
        }
      } {
        if(i==p[j]){
          f++;
          break;
        }
      } if(i==p[j]){
          f++;
          break;
        } i==p[j] i p[j] p j {
          f++;
          break;
        } f++ f break; if(f==0){
        a[l]=i;
        l++;
      } f==0 f 0 {
        a[l]=i;
        l++;
      } a[l]=i a[l] a l i l++ l if(n==0){
      System.out.println(x);
    }else{
      for(int i=0;i<a.length;i++){
        if(min<=(int)Math.abs(x-a[i])){
          System.out.println(a[i-1]);
          break;
        }else{
          min=(int)Math.abs(x-a[i]);
        }
      }
    } n==0 n 0 {
      System.out.println(x);
    } System.out.println(x) System.out.println System.out System System.out x {
      for(int i=0;i<a.length;i++){
        if(min<=(int)Math.abs(x-a[i])){
          System.out.println(a[i-1]);
          break;
        }else{
          min=(int)Math.abs(x-a[i]);
        }
      }
    } for(int i=0;i<a.length;i++){
        if(min<=(int)Math.abs(x-a[i])){
          System.out.println(a[i-1]);
          break;
        }else{
          min=(int)Math.abs(x-a[i]);
        }
      } int i=0; int i=0; i 0 i<a.length i a.length a a.length i++ i++ i {
        if(min<=(int)Math.abs(x-a[i])){
          System.out.println(a[i-1]);
          break;
        }else{
          min=(int)Math.abs(x-a[i]);
        }
      } {
        if(min<=(int)Math.abs(x-a[i])){
          System.out.println(a[i-1]);
          break;
        }else{
          min=(int)Math.abs(x-a[i]);
        }
      } if(min<=(int)Math.abs(x-a[i])){
          System.out.println(a[i-1]);
          break;
        }else{
          min=(int)Math.abs(x-a[i]);
        } min<=(int)Math.abs(x-a[i]) min (int)Math.abs(x-a[i]) Math.abs Math x-a[i] x a[i] a i {
          System.out.println(a[i-1]);
          break;
        } System.out.println(a[i-1]) System.out.println System.out System System.out a[i-1] a i-1 i 1 break; {
          min=(int)Math.abs(x-a[i]);
        } min=(int)Math.abs(x-a[i]) min (int)Math.abs(x-a[i]) Math.abs Math x-a[i] x a[i] a i String[] args args public class Main{
	
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	int x=sc.nextInt(),n=sc.nextInt(),min=301;
    int[] p=new int[n],a=new int[300-n];
    
    
    for(int i=0;i<n;i++){
      p[i]=sc.nextInt();
      
    }
    int l=0;
    for(int i=-150;i<150;i++){
      int f=0;
      for(int j=0;j<n;j++){
        if(i==p[j]){
          f++;
          break;
        }
      }
      if(f==0){
        a[l]=i;
        l++;
      }
    }
    
    if(n==0){
      System.out.println(x);
    }else{
      for(int i=0;i<a.length;i++){
        if(min<=(int)Math.abs(x-a[i])){
          System.out.println(a[i-1]);
          break;
        }else{
          min=(int)Math.abs(x-a[i]);
        }
      }
    }
  }
} public class Main{
	
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	int x=sc.nextInt(),n=sc.nextInt(),min=301;
    int[] p=new int[n],a=new int[300-n];
    
    
    for(int i=0;i<n;i++){
      p[i]=sc.nextInt();
      
    }
    int l=0;
    for(int i=-150;i<150;i++){
      int f=0;
      for(int j=0;j<n;j++){
        if(i==p[j]){
          f++;
          break;
        }
      }
      if(f==0){
        a[l]=i;
        l++;
      }
    }
    
    if(n==0){
      System.out.println(x);
    }else{
      for(int i=0;i<a.length;i++){
        if(min<=(int)Math.abs(x-a[i])){
          System.out.println(a[i-1]);
          break;
        }else{
          min=(int)Math.abs(x-a[i]);
        }
      }
    }
  }
} Main
import java.util.*;

public class Main{
	
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	int x=sc.nextInt(),n=sc.nextInt(),min=301;
    int[] p=new int[n],a=new int[300-n];
    
    
    for(int i=0;i<n;i++){
      p[i]=sc.nextInt();
      
    }
    int l=0;
    for(int i=-150;i<150;i++){
      int f=0;
      for(int j=0;j<n;j++){
        if(i==p[j]){
          f++;
          break;
        }
      }
      if(f==0){
        a[l]=i;
        l++;
      }
    }
    
    if(n==0){
      System.out.println(x);
    }else{
      for(int i=0;i<a.length;i++){
        if(min<=(int)Math.abs(x-a[i])){
          System.out.println(a[i-1]);
          break;
        }else{
          min=(int)Math.abs(x-a[i]);
        }
      }
    }
  }
}
