#include<stdio.h>

int main(void)
{
  int x,n;
  scanf("%d %d", &x, &n);

  if(n>0){
    int p[n];
    for(int i=0;i<n;i++){
      scanf("%d", &p[i]);
    }
    int tmp;
    for(int i=0;i<n-1;i++){
      for(int j=i+1;j<n;j++){
        if(p[i] > p[j]){
	  tmp = p[i];
	  p[i] = p[j];
	  p[j] = tmp;
        }
      }
    }

    int j=0;
    int ans;
    int dist=100;
    for(int i=-1;i<=101;i++){
      if(i==p[j]) j++;
      else{
        if(i<x) tmp = x - i;
        else tmp = i - x;

        if(dist>tmp){
	  dist = tmp;
	  ans = i;
        }
      }
    }
  
    printf("%d\n", ans);
  }
  else{
    printf("%d\n", x);
  }

  return 0;
}
