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=1001, sa, ans=-100;
    String p[] = new String[N];
    for(int i=0; i<N; i++) {
      p[i] = sc.next();
	}
    
    for(int j=0; j<=101; j++) {
      if(!Arrays.asList(p).contains(String.valueOf(j))) {
        if(X>=j) {
          sa=X-j;
        } else {
          sa=j-X;
        }
        if(min>sa) {
          ans = j;
          min=sa;
        }
      }  
    }
    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(), N=sc.nextInt(), min=1001, sa, ans=-100;
    String p[] = new String[N];
    for(int i=0; i<N; i++) {
      p[i] = sc.next();
	}
    
    for(int j=0; j<=101; j++) {
      if(!Arrays.asList(p).contains(String.valueOf(j))) {
        if(X>=j) {
          sa=X-j;
        } else {
          sa=j-X;
        }
        if(min>sa) {
          ans = j;
          min=sa;
        }
      }  
    }
    System.out.println(ans);
  }
} Main public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    int X = sc.nextInt(), N=sc.nextInt(), min=1001, sa, ans=-100;
    String p[] = new String[N];
    for(int i=0; i<N; i++) {
      p[i] = sc.next();
	}
    
    for(int j=0; j<=101; j++) {
      if(!Arrays.asList(p).contains(String.valueOf(j))) {
        if(X>=j) {
          sa=X-j;
        } else {
          sa=j-X;
        }
        if(min>sa) {
          ans = j;
          min=sa;
        }
      }  
    }
    System.out.println(ans);
  } main {
    Scanner sc = new Scanner(System.in);
    int X = sc.nextInt(), N=sc.nextInt(), min=1001, sa, ans=-100;
    String p[] = new String[N];
    for(int i=0; i<N; i++) {
      p[i] = sc.next();
	}
    
    for(int j=0; j<=101; j++) {
      if(!Arrays.asList(p).contains(String.valueOf(j))) {
        if(X>=j) {
          sa=X-j;
        } else {
          sa=j-X;
        }
        if(min>sa) {
          ans = j;
          min=sa;
        }
      }  
    }
    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 N=sc.nextInt() N sc.nextInt() sc.nextInt sc min=1001 min 1001 sa sa ans=-100; ans -100 100 String p[] = new String[N]; p new String[N] N for(int i=0; i<N; i++) {
      p[i] = sc.next();
	} int i=0; int i=0; i 0 i<N i N i++ i++ i {
      p[i] = sc.next();
	} {
      p[i] = sc.next();
	} p[i] = sc.next() p[i] p i sc.next() sc.next sc for(int j=0; j<=101; j++) {
      if(!Arrays.asList(p).contains(String.valueOf(j))) {
        if(X>=j) {
          sa=X-j;
        } else {
          sa=j-X;
        }
        if(min>sa) {
          ans = j;
          min=sa;
        }
      }  
    } int j=0; int j=0; j 0 j<=101 j 101 j++ j++ j {
      if(!Arrays.asList(p).contains(String.valueOf(j))) {
        if(X>=j) {
          sa=X-j;
        } else {
          sa=j-X;
        }
        if(min>sa) {
          ans = j;
          min=sa;
        }
      }  
    } {
      if(!Arrays.asList(p).contains(String.valueOf(j))) {
        if(X>=j) {
          sa=X-j;
        } else {
          sa=j-X;
        }
        if(min>sa) {
          ans = j;
          min=sa;
        }
      }  
    } if(!Arrays.asList(p).contains(String.valueOf(j))) {
        if(X>=j) {
          sa=X-j;
        } else {
          sa=j-X;
        }
        if(min>sa) {
          ans = j;
          min=sa;
        }
      } !Arrays.asList(p).contains(String.valueOf(j)) Arrays.asList(p).contains(String.valueOf(j)) Arrays.asList(p).contains Arrays.asList(p) Arrays.asList Arrays p String.valueOf(j) String.valueOf String j {
        if(X>=j) {
          sa=X-j;
        } else {
          sa=j-X;
        }
        if(min>sa) {
          ans = j;
          min=sa;
        }
      } if(X>=j) {
          sa=X-j;
        } else {
          sa=j-X;
        } X>=j X j {
          sa=X-j;
        } sa=X-j sa X-j X j {
          sa=j-X;
        } sa=j-X sa j-X j X if(min>sa) {
          ans = j;
          min=sa;
        } min>sa min sa {
          ans = j;
          min=sa;
        } ans = j ans j min=sa min sa 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(), N=sc.nextInt(), min=1001, sa, ans=-100;
    String p[] = new String[N];
    for(int i=0; i<N; i++) {
      p[i] = sc.next();
	}
    
    for(int j=0; j<=101; j++) {
      if(!Arrays.asList(p).contains(String.valueOf(j))) {
        if(X>=j) {
          sa=X-j;
        } else {
          sa=j-X;
        }
        if(min>sa) {
          ans = j;
          min=sa;
        }
      }  
    }
    System.out.println(ans);
  }
} public class Main{
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    int X = sc.nextInt(), N=sc.nextInt(), min=1001, sa, ans=-100;
    String p[] = new String[N];
    for(int i=0; i<N; i++) {
      p[i] = sc.next();
	}
    
    for(int j=0; j<=101; j++) {
      if(!Arrays.asList(p).contains(String.valueOf(j))) {
        if(X>=j) {
          sa=X-j;
        } else {
          sa=j-X;
        }
        if(min>sa) {
          ans = j;
          min=sa;
        }
      }  
    }
    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(), N=sc.nextInt(), min=1001, sa, ans=-100;
    String p[] = new String[N];
    for(int i=0; i<N; i++) {
      p[i] = sc.next();
	}
    
    for(int j=0; j<=101; j++) {
      if(!Arrays.asList(p).contains(String.valueOf(j))) {
        if(X>=j) {
          sa=X-j;
        } else {
          sa=j-X;
        }
        if(min>sa) {
          ans = j;
          min=sa;
        }
      }  
    }
    System.out.println(ans);
  }
}
