import java.util.*;
import java.io.*;

public class Main {
    public static void main(String args[]) {
      Scanner sc = new Scanner(System.in);

      int x = sc.nextInt();
      int n = sc.nextInt();
      int[] arr = new int[n];
      for(int i = 0; i < n; i++){
          arr[i] = sc.nextInt();
      }
      Arrays.sort(arr);
      
      int best = x;
      int minDistance = n;
      for(int i = 0; i <= 101; i++){
          boolean good = true;
          for(int j = 0; j < n; j++){
              if(arr[j] == i){
                  good = false;
                  break;
              }
          }
          if(good){
              if(Math.abs(x - i) < minDistance){
                  minDistance = Math.abs(x-i);
                  best = i;
              } else if(Math.abs(x-i) == minDistance){
                  best = Math.min(best, i);
              }
          }
      }
      System.out.println(best);
    }
} import java.util.*; util.* java import java.io.*; io.* java public class Main {
    public static void main(String args[]) {
      Scanner sc = new Scanner(System.in);

      int x = sc.nextInt();
      int n = sc.nextInt();
      int[] arr = new int[n];
      for(int i = 0; i < n; i++){
          arr[i] = sc.nextInt();
      }
      Arrays.sort(arr);
      
      int best = x;
      int minDistance = n;
      for(int i = 0; i <= 101; i++){
          boolean good = true;
          for(int j = 0; j < n; j++){
              if(arr[j] == i){
                  good = false;
                  break;
              }
          }
          if(good){
              if(Math.abs(x - i) < minDistance){
                  minDistance = Math.abs(x-i);
                  best = i;
              } else if(Math.abs(x-i) == minDistance){
                  best = Math.min(best, i);
              }
          }
      }
      System.out.println(best);
    }
} Main public static void main(String args[]) {
      Scanner sc = new Scanner(System.in);

      int x = sc.nextInt();
      int n = sc.nextInt();
      int[] arr = new int[n];
      for(int i = 0; i < n; i++){
          arr[i] = sc.nextInt();
      }
      Arrays.sort(arr);
      
      int best = x;
      int minDistance = n;
      for(int i = 0; i <= 101; i++){
          boolean good = true;
          for(int j = 0; j < n; j++){
              if(arr[j] == i){
                  good = false;
                  break;
              }
          }
          if(good){
              if(Math.abs(x - i) < minDistance){
                  minDistance = Math.abs(x-i);
                  best = i;
              } else if(Math.abs(x-i) == minDistance){
                  best = Math.min(best, i);
              }
          }
      }
      System.out.println(best);
    } main {
      Scanner sc = new Scanner(System.in);

      int x = sc.nextInt();
      int n = sc.nextInt();
      int[] arr = new int[n];
      for(int i = 0; i < n; i++){
          arr[i] = sc.nextInt();
      }
      Arrays.sort(arr);
      
      int best = x;
      int minDistance = n;
      for(int i = 0; i <= 101; i++){
          boolean good = true;
          for(int j = 0; j < n; j++){
              if(arr[j] == i){
                  good = false;
                  break;
              }
          }
          if(good){
              if(Math.abs(x - i) < minDistance){
                  minDistance = Math.abs(x-i);
                  best = i;
              } else if(Math.abs(x-i) == minDistance){
                  best = Math.min(best, i);
              }
          }
      }
      System.out.println(best);
    } 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 int[] arr = new int[n]; arr new int[n] n for(int i = 0; i < n; i++){
          arr[i] = sc.nextInt();
      } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
          arr[i] = sc.nextInt();
      } {
          arr[i] = sc.nextInt();
      } arr[i] = sc.nextInt() arr[i] arr i sc.nextInt() sc.nextInt sc Arrays.sort(arr) Arrays.sort Arrays arr int best = x; best x int minDistance = n; minDistance n for(int i = 0; i <= 101; i++){
          boolean good = true;
          for(int j = 0; j < n; j++){
              if(arr[j] == i){
                  good = false;
                  break;
              }
          }
          if(good){
              if(Math.abs(x - i) < minDistance){
                  minDistance = Math.abs(x-i);
                  best = i;
              } else if(Math.abs(x-i) == minDistance){
                  best = Math.min(best, i);
              }
          }
      } int i = 0; int i = 0; i 0 i <= 101 i 101 i++ i++ i {
          boolean good = true;
          for(int j = 0; j < n; j++){
              if(arr[j] == i){
                  good = false;
                  break;
              }
          }
          if(good){
              if(Math.abs(x - i) < minDistance){
                  minDistance = Math.abs(x-i);
                  best = i;
              } else if(Math.abs(x-i) == minDistance){
                  best = Math.min(best, i);
              }
          }
      } {
          boolean good = true;
          for(int j = 0; j < n; j++){
              if(arr[j] == i){
                  good = false;
                  break;
              }
          }
          if(good){
              if(Math.abs(x - i) < minDistance){
                  minDistance = Math.abs(x-i);
                  best = i;
              } else if(Math.abs(x-i) == minDistance){
                  best = Math.min(best, i);
              }
          }
      } boolean good = true; good true for(int j = 0; j < n; j++){
              if(arr[j] == i){
                  good = false;
                  break;
              }
          } int j = 0; int j = 0; j 0 j < n j n j++ j++ j {
              if(arr[j] == i){
                  good = false;
                  break;
              }
          } {
              if(arr[j] == i){
                  good = false;
                  break;
              }
          } if(arr[j] == i){
                  good = false;
                  break;
              } arr[j] == i arr[j] arr j i {
                  good = false;
                  break;
              } good = false good false break; if(good){
              if(Math.abs(x - i) < minDistance){
                  minDistance = Math.abs(x-i);
                  best = i;
              } else if(Math.abs(x-i) == minDistance){
                  best = Math.min(best, i);
              }
          } good {
              if(Math.abs(x - i) < minDistance){
                  minDistance = Math.abs(x-i);
                  best = i;
              } else if(Math.abs(x-i) == minDistance){
                  best = Math.min(best, i);
              }
          } if(Math.abs(x - i) < minDistance){
                  minDistance = Math.abs(x-i);
                  best = i;
              } else if(Math.abs(x-i) == minDistance){
                  best = Math.min(best, i);
              } Math.abs(x - i) < minDistance Math.abs(x - i) Math.abs Math x - i x i minDistance {
                  minDistance = Math.abs(x-i);
                  best = i;
              } minDistance = Math.abs(x-i) minDistance Math.abs(x-i) Math.abs Math x-i x i best = i best i if(Math.abs(x-i) == minDistance){
                  best = Math.min(best, i);
              } Math.abs(x-i) == minDistance Math.abs(x-i) Math.abs Math x-i x i minDistance {
                  best = Math.min(best, i);
              } best = Math.min(best, i) best Math.min(best, i) Math.min Math best i System.out.println(best) System.out.println System.out System System.out best 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();
      int[] arr = new int[n];
      for(int i = 0; i < n; i++){
          arr[i] = sc.nextInt();
      }
      Arrays.sort(arr);
      
      int best = x;
      int minDistance = n;
      for(int i = 0; i <= 101; i++){
          boolean good = true;
          for(int j = 0; j < n; j++){
              if(arr[j] == i){
                  good = false;
                  break;
              }
          }
          if(good){
              if(Math.abs(x - i) < minDistance){
                  minDistance = Math.abs(x-i);
                  best = i;
              } else if(Math.abs(x-i) == minDistance){
                  best = Math.min(best, i);
              }
          }
      }
      System.out.println(best);
    }
} public class Main {
    public static void main(String args[]) {
      Scanner sc = new Scanner(System.in);

      int x = sc.nextInt();
      int n = sc.nextInt();
      int[] arr = new int[n];
      for(int i = 0; i < n; i++){
          arr[i] = sc.nextInt();
      }
      Arrays.sort(arr);
      
      int best = x;
      int minDistance = n;
      for(int i = 0; i <= 101; i++){
          boolean good = true;
          for(int j = 0; j < n; j++){
              if(arr[j] == i){
                  good = false;
                  break;
              }
          }
          if(good){
              if(Math.abs(x - i) < minDistance){
                  minDistance = Math.abs(x-i);
                  best = i;
              } else if(Math.abs(x-i) == minDistance){
                  best = Math.min(best, i);
              }
          }
      }
      System.out.println(best);
    }
} Main
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String args[]) {
      Scanner sc = new Scanner(System.in);

      int x = sc.nextInt();
      int n = sc.nextInt();
      int[] arr = new int[n];
      for(int i = 0; i < n; i++){
          arr[i] = sc.nextInt();
      }
      Arrays.sort(arr);
      
      int best = x;
      int minDistance = n;
      for(int i = 0; i <= 101; i++){
          boolean good = true;
          for(int j = 0; j < n; j++){
              if(arr[j] == i){
                  good = false;
                  break;
              }
          }
          if(good){
              if(Math.abs(x - i) < minDistance){
                  minDistance = Math.abs(x-i);
                  best = i;
              } else if(Math.abs(x-i) == minDistance){
                  best = Math.min(best, i);
              }
          }
      }
      System.out.println(best);
    }
}