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

int main(){
  int X,N;
  scanf("%d",&X);
  scanf("%d",&N);
  int p[100];
  for (int i=0; i<N; i++){
      scanf("%d", p+i);
  }
  int l[100][2];
  for (int i=0; i<100; i++){
      l[i][0] = 0;
      l[i][1] = 0;
  }
  for (int i=0; i<N; i++){
      if (p[i] == X){
        l[0][0] = 1;
        l[0][1] = 1;
      }else if (p[i] < X){
          l[abs(p[i] - X)][0] = 1;
      }else{
          l[abs(p[i] - X)][1] = 1;
      }
  }
  for (int i=0; i<100; i++){
    if (l[i][0] == 0){
      printf("%d",X-i);
      return 0;
    }
    else if (l[i][1] == 0){
      printf("%d",X+i);
      return 0;
    }
  }
  return 0;
}