import java.util.*;
public class Main {
    public static void main(String args[]) {
  Scanner sc = new Scanner(System.in);
  int x = sc.nextInt();
  int n = sc.nextInt();
  
  boolean[] ok = new boolean[201];
  for(int i =0;i<n;i++){
      int c = sc.nextInt();
      ok[c] =true;
  }
  int result = 500;
  int diff = 500;
  for(int i =0;i<=200;i++){
      if(!ok[i]){
          int abs = Math.abs(x-i);
          if(abs<diff){
              result =i;
              diff = abs;
          }else if(abs == diff){
                result = Math.min(result, i);
          }
      }
  }
  System.out.println(result);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String args[]) {
  Scanner sc = new Scanner(System.in);
  int x = sc.nextInt();
  int n = sc.nextInt();
  
  boolean[] ok = new boolean[201];
  for(int i =0;i<n;i++){
      int c = sc.nextInt();
      ok[c] =true;
  }
  int result = 500;
  int diff = 500;
  for(int i =0;i<=200;i++){
      if(!ok[i]){
          int abs = Math.abs(x-i);
          if(abs<diff){
              result =i;
              diff = abs;
          }else if(abs == diff){
                result = Math.min(result, i);
          }
      }
  }
  System.out.println(result);
    }
} Main public static void main(String args[]) {
  Scanner sc = new Scanner(System.in);
  int x = sc.nextInt();
  int n = sc.nextInt();
  
  boolean[] ok = new boolean[201];
  for(int i =0;i<n;i++){
      int c = sc.nextInt();
      ok[c] =true;
  }
  int result = 500;
  int diff = 500;
  for(int i =0;i<=200;i++){
      if(!ok[i]){
          int abs = Math.abs(x-i);
          if(abs<diff){
              result =i;
              diff = abs;
          }else if(abs == diff){
                result = Math.min(result, i);
          }
      }
  }
  System.out.println(result);
    } main {
  Scanner sc = new Scanner(System.in);
  int x = sc.nextInt();
  int n = sc.nextInt();
  
  boolean[] ok = new boolean[201];
  for(int i =0;i<n;i++){
      int c = sc.nextInt();
      ok[c] =true;
  }
  int result = 500;
  int diff = 500;
  for(int i =0;i<=200;i++){
      if(!ok[i]){
          int abs = Math.abs(x-i);
          if(abs<diff){
              result =i;
              diff = abs;
          }else if(abs == diff){
                result = Math.min(result, i);
          }
      }
  }
  System.out.println(result);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc boolean[] ok = new boolean[201]; ok new boolean[201] 201 for(int i =0;i<n;i++){
      int c = sc.nextInt();
      ok[c] =true;
  } int i =0; int i =0; i 0 i<n i n i++ i++ i {
      int c = sc.nextInt();
      ok[c] =true;
  } {
      int c = sc.nextInt();
      ok[c] =true;
  } int c = sc.nextInt(); c sc.nextInt() sc.nextInt sc ok[c] =true ok[c] ok c true int result = 500; result 500 int diff = 500; diff 500 for(int i =0;i<=200;i++){
      if(!ok[i]){
          int abs = Math.abs(x-i);
          if(abs<diff){
              result =i;
              diff = abs;
          }else if(abs == diff){
                result = Math.min(result, i);
          }
      }
  } int i =0; int i =0; i 0 i<=200 i 200 i++ i++ i {
      if(!ok[i]){
          int abs = Math.abs(x-i);
          if(abs<diff){
              result =i;
              diff = abs;
          }else if(abs == diff){
                result = Math.min(result, i);
          }
      }
  } {
      if(!ok[i]){
          int abs = Math.abs(x-i);
          if(abs<diff){
              result =i;
              diff = abs;
          }else if(abs == diff){
                result = Math.min(result, i);
          }
      }
  } if(!ok[i]){
          int abs = Math.abs(x-i);
          if(abs<diff){
              result =i;
              diff = abs;
          }else if(abs == diff){
                result = Math.min(result, i);
          }
      } !ok[i] ok[i] ok i {
          int abs = Math.abs(x-i);
          if(abs<diff){
              result =i;
              diff = abs;
          }else if(abs == diff){
                result = Math.min(result, i);
          }
      } int abs = Math.abs(x-i); abs Math.abs(x-i) Math.abs Math x-i x i if(abs<diff){
              result =i;
              diff = abs;
          }else if(abs == diff){
                result = Math.min(result, i);
          } abs<diff abs diff {
              result =i;
              diff = abs;
          } result =i result i diff = abs diff abs if(abs == diff){
                result = Math.min(result, i);
          } abs == diff abs diff {
                result = Math.min(result, i);
          } result = Math.min(result, i) result Math.min(result, i) Math.min Math result i System.out.println(result) System.out.println System.out System System.out result String args[] args public class Main {
    public static void main(String args[]) {
  Scanner sc = new Scanner(System.in);
  int x = sc.nextInt();
  int n = sc.nextInt();
  
  boolean[] ok = new boolean[201];
  for(int i =0;i<n;i++){
      int c = sc.nextInt();
      ok[c] =true;
  }
  int result = 500;
  int diff = 500;
  for(int i =0;i<=200;i++){
      if(!ok[i]){
          int abs = Math.abs(x-i);
          if(abs<diff){
              result =i;
              diff = abs;
          }else if(abs == diff){
                result = Math.min(result, i);
          }
      }
  }
  System.out.println(result);
    }
} public class Main {
    public static void main(String args[]) {
  Scanner sc = new Scanner(System.in);
  int x = sc.nextInt();
  int n = sc.nextInt();
  
  boolean[] ok = new boolean[201];
  for(int i =0;i<n;i++){
      int c = sc.nextInt();
      ok[c] =true;
  }
  int result = 500;
  int diff = 500;
  for(int i =0;i<=200;i++){
      if(!ok[i]){
          int abs = Math.abs(x-i);
          if(abs<diff){
              result =i;
              diff = abs;
          }else if(abs == diff){
                result = Math.min(result, i);
          }
      }
  }
  System.out.println(result);
    }
} Main
import java.util.*;
public class Main {
    public static void main(String args[]) {
  Scanner sc = new Scanner(System.in);
  int x = sc.nextInt();
  int n = sc.nextInt();
  
  boolean[] ok = new boolean[201];
  for(int i =0;i<n;i++){
      int c = sc.nextInt();
      ok[c] =true;
  }
  int result = 500;
  int diff = 500;
  for(int i =0;i<=200;i++){
      if(!ok[i]){
          int abs = Math.abs(x-i);
          if(abs<diff){
              result =i;
              diff = abs;
          }else if(abs == diff){
                result = Math.min(result, i);
          }
      }
  }
  System.out.println(result);
    }
}