#include<stdio.h>

int main(){
  int x,n; 
  int flaga = 0;
  int flagb = 0;
  scanf("%d%d",&x,&n);
  int p[n];
  if(n == 0){
    printf(x);
  }
  for(int i = 0;i < n;i++){
    scanf("%d",&p[i]);
  }

  for(int i = 0;i<n;i++){
    for(int j = 0;j<n;j++){
        if (x-i == p[j]){
            flaga = 1;
        }
        if(x+i == p[j]){
            flagb = 1;
        }
    }
    if(flaga == 0){
        printf(x-i);
    }else if(flagb == 0){
        printf(x+i);
    }else if(flaga == 0 and flagb == 0){
        printf(x-i);
    }
  }
}
        
      
