    import java.util.*;
     
    class Main {
      public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i = 0; i < n; i++)
          a[i] = sc.nextInt();
        
        Arrays.sort(a);
        int t=0,ans=0,f=0;
        while(f == 0) {
          if(Arrays.binarySearch(a, x-t) < 0) {
           ans = x - t;
            f = 1;
          } else if(Arrays.binarySearch(a, x+t) < 0) {
            ans = x + t;
            f = 1;
          }
          t++;
        }
        System.out.println(ans);
      }
    } import java.util.*; util.* java class Main {
      public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i = 0; i < n; i++)
          a[i] = sc.nextInt();
        
        Arrays.sort(a);
        int t=0,ans=0,f=0;
        while(f == 0) {
          if(Arrays.binarySearch(a, x-t) < 0) {
           ans = x - t;
            f = 1;
          } else if(Arrays.binarySearch(a, x+t) < 0) {
            ans = x + t;
            f = 1;
          }
          t++;
        }
        System.out.println(ans);
      }
    } Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i = 0; i < n; i++)
          a[i] = sc.nextInt();
        
        Arrays.sort(a);
        int t=0,ans=0,f=0;
        while(f == 0) {
          if(Arrays.binarySearch(a, x-t) < 0) {
           ans = x - t;
            f = 1;
          } else if(Arrays.binarySearch(a, x+t) < 0) {
            ans = x + t;
            f = 1;
          }
          t++;
        }
        System.out.println(ans);
      } main {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i = 0; i < n; i++)
          a[i] = sc.nextInt();
        
        Arrays.sort(a);
        int t=0,ans=0,f=0;
        while(f == 0) {
          if(Arrays.binarySearch(a, x-t) < 0) {
           ans = x - t;
            f = 1;
          } else if(Arrays.binarySearch(a, x+t) < 0) {
            ans = x + t;
            f = 1;
          }
          t++;
        }
        System.out.println(ans);
      } 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[] a = new int[n]; a new int[n] n for(int i = 0; i < n; i++)
          a[i] = sc.nextInt(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i a[i] = sc.nextInt(); a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc Arrays.sort(a) Arrays.sort Arrays a int t=0 t 0 ans=0 ans 0 f=0; f 0 while(f == 0) {
          if(Arrays.binarySearch(a, x-t) < 0) {
           ans = x - t;
            f = 1;
          } else if(Arrays.binarySearch(a, x+t) < 0) {
            ans = x + t;
            f = 1;
          }
          t++;
        } f == 0 f 0 {
          if(Arrays.binarySearch(a, x-t) < 0) {
           ans = x - t;
            f = 1;
          } else if(Arrays.binarySearch(a, x+t) < 0) {
            ans = x + t;
            f = 1;
          }
          t++;
        } if(Arrays.binarySearch(a, x-t) < 0) {
           ans = x - t;
            f = 1;
          } else if(Arrays.binarySearch(a, x+t) < 0) {
            ans = x + t;
            f = 1;
          } Arrays.binarySearch(a, x-t) < 0 Arrays.binarySearch(a, x-t) Arrays.binarySearch Arrays a x-t x t 0 {
           ans = x - t;
            f = 1;
          } ans = x - t ans x - t x t f = 1 f 1 if(Arrays.binarySearch(a, x+t) < 0) {
            ans = x + t;
            f = 1;
          } Arrays.binarySearch(a, x+t) < 0 Arrays.binarySearch(a, x+t) Arrays.binarySearch Arrays a x+t x t 0 {
            ans = x + t;
            f = 1;
          } ans = x + t ans x + t x t f = 1 f 1 t++ t System.out.println(ans) System.out.println System.out System System.out ans String[] args args
    import java.util.*;
     
    class Main {
      public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i = 0; i < n; i++)
          a[i] = sc.nextInt();
        
        Arrays.sort(a);
        int t=0,ans=0,f=0;
        while(f == 0) {
          if(Arrays.binarySearch(a, x-t) < 0) {
           ans = x - t;
            f = 1;
          } else if(Arrays.binarySearch(a, x+t) < 0) {
            ans = x + t;
            f = 1;
          }
          t++;
        }
        System.out.println(ans);
      }
    }