#include <stdio.h>

int main(void)
{

  int X;
  int N;
  int p[100];

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

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

  int absolute = 0;
  int ans=0;
  while(X != absolute){
    for(int i = 0;i<N;i++){
        if(X-absolute == p[i]){
          break;
        }

        if(i == N-1){
          ans = X-absolute;
          printf("%d\n",ans);
          return 0;
        }
    }
    for(int j = 0;j<N;j++){
      if(X+absolute == p[j]){
        break;
      }

      if(j == N-1){
        ans = X+absolute;
        printf("%d\n",ans);
        return 0;
      }

    }
      absolute++;
  }

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

  return 0;
}