import java.util.*;

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

class Main {
  public static void main(String[] args) {
    Set<Integer> set = new HashSet<>();
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int n = sc.nextInt();
    int[] p = new int[n];
    for(int i = 0; i < n; i++)
      p[i] = sc.nextInt();
    
    Arrays.sort(p);
    int diff = 0, flag = 0, res = 0;
    while(flag == 0) {
      if(Arrays.binarySearch(p, x-diff) < 0) {
        res = x - diff;
        flag = 1;
      } else if(Arrays.binarySearch(p, x+diff) < 0) {
        res = x + diff;
        flag = 1;
      }
      diff++;
    }
    System.out.println(res);
  }
}
