#include<stdio.h>
#include <stdlib.h>
#include<math.h>

int main (void){

  int X,N,p[256],left,ans=100,count=0,mini=100;

  scanf("%d %d",&X,&N);

  if(N==0){
    printf("%d\n",X);
    exit(1);
  }

  if((1<=X)&&(X<=100)){
   if((0<=N)&&(N<=100)){

   for (int i = 0; i < N; i++) {
      scanf("%d",&p[i]);


      if((1>p[i])||(p[i]>100)){
        exit(1);
      }

   }

  for (int j = 0; j < 100; j++) {
    left=fabs(X-j);

    if(left<ans){

      for (int k = 0; k < N; k++) {

        if(j==p[k]){
          count++;
      }

      }
      if(count==0){
  ans=left;
    mini=j;
  }


    }

  }

  printf("%d\n",mini);


}}

  return 0;
}
