import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int key = sc.nextInt();
    int num = sc.nextInt();
    if(num > 0){
      int map[] = new int[102];
      for(int i = 0;i < 102;i++){
        map[i] = 0;
      }
      for(int i = 0;i < num;i++){
        int n = sc.nextInt();
        map[n] = n;
      }
      int plus = key;
      int minus = key;
      while(map[plus] != 0 && map[minus] != 0){
        plus++;
        minus--;
        if(map[plus] == 0 && map[minus] == 0){
            break;
        }
        else if(map[plus] == 0){
            minus--;
        }
        else if(map[minus] == 0){
            plus++;
        }
        
      }
      if(key - minus <= plus - key){
        System.out.println(minus);
      }
      else{
        System.out.println(plus);
      }
    }
    else{
      System.out.println(key);
    }
  }
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz