import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner scn = new Scanner(System.in);
      	int x = scn.nextInt();
      	int n = scn.nextInt();
      	if(n == 0){
          System.out.println(x);
          return;
        }
      	
      	Integer[] nums = new Integer[n];
      	for(int i = 0; i < n; i++){
          nums[i] = scn.nextInt();
        }
      
      	int num = x;      	
      	for(int i = 0; i < 51;i++){
	      	if(!Arrays.asList(nums).contains(x-i)){
              System.out.println(x - i);
              return;
    	    }
          	if(!Arrays.asList(nums).contains(x+i)){
              System.out.println(x + i);
              return;
            }
        }
	}
}
 import java.util.*; util.* java class Main{
	public static void main(String[] args){
		Scanner scn = new Scanner(System.in);
      	int x = scn.nextInt();
      	int n = scn.nextInt();
      	if(n == 0){
          System.out.println(x);
          return;
        }
      	
      	Integer[] nums = new Integer[n];
      	for(int i = 0; i < n; i++){
          nums[i] = scn.nextInt();
        }
      
      	int num = x;      	
      	for(int i = 0; i < 51;i++){
	      	if(!Arrays.asList(nums).contains(x-i)){
              System.out.println(x - i);
              return;
    	    }
          	if(!Arrays.asList(nums).contains(x+i)){
              System.out.println(x + i);
              return;
            }
        }
	}
} Main public static void main(String[] args){
		Scanner scn = new Scanner(System.in);
      	int x = scn.nextInt();
      	int n = scn.nextInt();
      	if(n == 0){
          System.out.println(x);
          return;
        }
      	
      	Integer[] nums = new Integer[n];
      	for(int i = 0; i < n; i++){
          nums[i] = scn.nextInt();
        }
      
      	int num = x;      	
      	for(int i = 0; i < 51;i++){
	      	if(!Arrays.asList(nums).contains(x-i)){
              System.out.println(x - i);
              return;
    	    }
          	if(!Arrays.asList(nums).contains(x+i)){
              System.out.println(x + i);
              return;
            }
        }
	} main {
		Scanner scn = new Scanner(System.in);
      	int x = scn.nextInt();
      	int n = scn.nextInt();
      	if(n == 0){
          System.out.println(x);
          return;
        }
      	
      	Integer[] nums = new Integer[n];
      	for(int i = 0; i < n; i++){
          nums[i] = scn.nextInt();
        }
      
      	int num = x;      	
      	for(int i = 0; i < 51;i++){
	      	if(!Arrays.asList(nums).contains(x-i)){
              System.out.println(x - i);
              return;
    	    }
          	if(!Arrays.asList(nums).contains(x+i)){
              System.out.println(x + i);
              return;
            }
        }
	} Scanner scn = new Scanner(System.in); scn new Scanner(System.in) int x = scn.nextInt(); x scn.nextInt() scn.nextInt scn int n = scn.nextInt(); n scn.nextInt() scn.nextInt scn 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; Integer[] nums = new Integer[n]; nums new Integer[n] n for(int i = 0; i < n; i++){
          nums[i] = scn.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
          nums[i] = scn.nextInt();
        } {
          nums[i] = scn.nextInt();
        } nums[i] = scn.nextInt() nums[i] nums i scn.nextInt() scn.nextInt scn int num = x; num x for(int i = 0; i < 51;i++){
	      	if(!Arrays.asList(nums).contains(x-i)){
              System.out.println(x - i);
              return;
    	    }
          	if(!Arrays.asList(nums).contains(x+i)){
              System.out.println(x + i);
              return;
            }
        } int i = 0; int i = 0; i 0 i < 51 i 51 i++ i++ i {
	      	if(!Arrays.asList(nums).contains(x-i)){
              System.out.println(x - i);
              return;
    	    }
          	if(!Arrays.asList(nums).contains(x+i)){
              System.out.println(x + i);
              return;
            }
        } {
	      	if(!Arrays.asList(nums).contains(x-i)){
              System.out.println(x - i);
              return;
    	    }
          	if(!Arrays.asList(nums).contains(x+i)){
              System.out.println(x + i);
              return;
            }
        } if(!Arrays.asList(nums).contains(x-i)){
              System.out.println(x - i);
              return;
    	    } !Arrays.asList(nums).contains(x-i) Arrays.asList(nums).contains(x-i) Arrays.asList(nums).contains Arrays.asList(nums) Arrays.asList Arrays nums x-i x i {
              System.out.println(x - i);
              return;
    	    } System.out.println(x - i) System.out.println System.out System System.out x - i x i return; if(!Arrays.asList(nums).contains(x+i)){
              System.out.println(x + i);
              return;
            } !Arrays.asList(nums).contains(x+i) Arrays.asList(nums).contains(x+i) Arrays.asList(nums).contains Arrays.asList(nums) Arrays.asList Arrays nums x+i x i {
              System.out.println(x + i);
              return;
            } System.out.println(x + i) System.out.println System.out System System.out x + i x i return; String[] args args
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner scn = new Scanner(System.in);
      	int x = scn.nextInt();
      	int n = scn.nextInt();
      	if(n == 0){
          System.out.println(x);
          return;
        }
      	
      	Integer[] nums = new Integer[n];
      	for(int i = 0; i < n; i++){
          nums[i] = scn.nextInt();
        }
      
      	int num = x;      	
      	for(int i = 0; i < 51;i++){
	      	if(!Arrays.asList(nums).contains(x-i)){
              System.out.println(x - i);
              return;
    	    }
          	if(!Arrays.asList(nums).contains(x+i)){
              System.out.println(x + i);
              return;
            }
        }
	}
}

