import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int key = sc.nextInt();
    int num = sc.nextInt();
    if(num > 0){
      int map[] = new int[102];
      for(int i = 0;i < 102;i++){
        map[i] = 0;
      }
      for(int i = 0;i < num;i++){
        int n = sc.nextInt();
        map[n] = n;
      }
      int plus = key;
      int minus = key;
      while(map[plus] != 0 && map[minus] != 0){
        plus++;
        minus--;
        if(map[plus] == 0 && map[minus] == 0){
            break;
        }
        else if(map[plus] == 0){
            minus--;
        }
        else if(map[minus] == 0){
            plus++;
        }
        
      }
      if(key - minus <= plus - key){
        System.out.println(minus);
      }
      else{
        System.out.println(plus);
      }
    }
    else{
      System.out.println(key);
    }
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int key = sc.nextInt();
    int num = sc.nextInt();
    if(num > 0){
      int map[] = new int[102];
      for(int i = 0;i < 102;i++){
        map[i] = 0;
      }
      for(int i = 0;i < num;i++){
        int n = sc.nextInt();
        map[n] = n;
      }
      int plus = key;
      int minus = key;
      while(map[plus] != 0 && map[minus] != 0){
        plus++;
        minus--;
        if(map[plus] == 0 && map[minus] == 0){
            break;
        }
        else if(map[plus] == 0){
            minus--;
        }
        else if(map[minus] == 0){
            plus++;
        }
        
      }
      if(key - minus <= plus - key){
        System.out.println(minus);
      }
      else{
        System.out.println(plus);
      }
    }
    else{
      System.out.println(key);
    }
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int key = sc.nextInt();
    int num = sc.nextInt();
    if(num > 0){
      int map[] = new int[102];
      for(int i = 0;i < 102;i++){
        map[i] = 0;
      }
      for(int i = 0;i < num;i++){
        int n = sc.nextInt();
        map[n] = n;
      }
      int plus = key;
      int minus = key;
      while(map[plus] != 0 && map[minus] != 0){
        plus++;
        minus--;
        if(map[plus] == 0 && map[minus] == 0){
            break;
        }
        else if(map[plus] == 0){
            minus--;
        }
        else if(map[minus] == 0){
            plus++;
        }
        
      }
      if(key - minus <= plus - key){
        System.out.println(minus);
      }
      else{
        System.out.println(plus);
      }
    }
    else{
      System.out.println(key);
    }
  } main {
    Scanner sc = new Scanner(System.in);
    int key = sc.nextInt();
    int num = sc.nextInt();
    if(num > 0){
      int map[] = new int[102];
      for(int i = 0;i < 102;i++){
        map[i] = 0;
      }
      for(int i = 0;i < num;i++){
        int n = sc.nextInt();
        map[n] = n;
      }
      int plus = key;
      int minus = key;
      while(map[plus] != 0 && map[minus] != 0){
        plus++;
        minus--;
        if(map[plus] == 0 && map[minus] == 0){
            break;
        }
        else if(map[plus] == 0){
            minus--;
        }
        else if(map[minus] == 0){
            plus++;
        }
        
      }
      if(key - minus <= plus - key){
        System.out.println(minus);
      }
      else{
        System.out.println(plus);
      }
    }
    else{
      System.out.println(key);
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int key = sc.nextInt(); key sc.nextInt() sc.nextInt sc int num = sc.nextInt(); num sc.nextInt() sc.nextInt sc if(num > 0){
      int map[] = new int[102];
      for(int i = 0;i < 102;i++){
        map[i] = 0;
      }
      for(int i = 0;i < num;i++){
        int n = sc.nextInt();
        map[n] = n;
      }
      int plus = key;
      int minus = key;
      while(map[plus] != 0 && map[minus] != 0){
        plus++;
        minus--;
        if(map[plus] == 0 && map[minus] == 0){
            break;
        }
        else if(map[plus] == 0){
            minus--;
        }
        else if(map[minus] == 0){
            plus++;
        }
        
      }
      if(key - minus <= plus - key){
        System.out.println(minus);
      }
      else{
        System.out.println(plus);
      }
    }
    else{
      System.out.println(key);
    } num > 0 num 0 {
      int map[] = new int[102];
      for(int i = 0;i < 102;i++){
        map[i] = 0;
      }
      for(int i = 0;i < num;i++){
        int n = sc.nextInt();
        map[n] = n;
      }
      int plus = key;
      int minus = key;
      while(map[plus] != 0 && map[minus] != 0){
        plus++;
        minus--;
        if(map[plus] == 0 && map[minus] == 0){
            break;
        }
        else if(map[plus] == 0){
            minus--;
        }
        else if(map[minus] == 0){
            plus++;
        }
        
      }
      if(key - minus <= plus - key){
        System.out.println(minus);
      }
      else{
        System.out.println(plus);
      }
    } int map[] = new int[102]; map new int[102] 102 for(int i = 0;i < 102;i++){
        map[i] = 0;
      } int i = 0; int i = 0; i 0 i < 102 i 102 i++ i++ i {
        map[i] = 0;
      } {
        map[i] = 0;
      } map[i] = 0 map[i] map i 0 for(int i = 0;i < num;i++){
        int n = sc.nextInt();
        map[n] = n;
      } int i = 0; int i = 0; i 0 i < num i num i++ i++ i {
        int n = sc.nextInt();
        map[n] = n;
      } {
        int n = sc.nextInt();
        map[n] = n;
      } int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc map[n] = n map[n] map n n int plus = key; plus key int minus = key; minus key while(map[plus] != 0 && map[minus] != 0){
        plus++;
        minus--;
        if(map[plus] == 0 && map[minus] == 0){
            break;
        }
        else if(map[plus] == 0){
            minus--;
        }
        else if(map[minus] == 0){
            plus++;
        }
        
      } map[plus] != 0 && map[minus] != 0 map[plus] != 0 map[plus] map plus 0 map[minus] != 0 map[minus] map minus 0 {
        plus++;
        minus--;
        if(map[plus] == 0 && map[minus] == 0){
            break;
        }
        else if(map[plus] == 0){
            minus--;
        }
        else if(map[minus] == 0){
            plus++;
        }
        
      } plus++ plus minus-- minus if(map[plus] == 0 && map[minus] == 0){
            break;
        }
        else if(map[plus] == 0){
            minus--;
        }
        else if(map[minus] == 0){
            plus++;
        } map[plus] == 0 && map[minus] == 0 map[plus] == 0 map[plus] map plus 0 map[minus] == 0 map[minus] map minus 0 {
            break;
        } break; if(map[plus] == 0){
            minus--;
        }
        else if(map[minus] == 0){
            plus++;
        } map[plus] == 0 map[plus] map plus 0 {
            minus--;
        } minus-- minus if(map[minus] == 0){
            plus++;
        } map[minus] == 0 map[minus] map minus 0 {
            plus++;
        } plus++ plus if(key - minus <= plus - key){
        System.out.println(minus);
      }
      else{
        System.out.println(plus);
      } key - minus <= plus - key key - minus key minus plus - key plus key {
        System.out.println(minus);
      } System.out.println(minus) System.out.println System.out System System.out minus {
        System.out.println(plus);
      } System.out.println(plus) System.out.println System.out System System.out plus {
      System.out.println(key);
    } System.out.println(key) System.out.println System.out System System.out key String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int key = sc.nextInt();
    int num = sc.nextInt();
    if(num > 0){
      int map[] = new int[102];
      for(int i = 0;i < 102;i++){
        map[i] = 0;
      }
      for(int i = 0;i < num;i++){
        int n = sc.nextInt();
        map[n] = n;
      }
      int plus = key;
      int minus = key;
      while(map[plus] != 0 && map[minus] != 0){
        plus++;
        minus--;
        if(map[plus] == 0 && map[minus] == 0){
            break;
        }
        else if(map[plus] == 0){
            minus--;
        }
        else if(map[minus] == 0){
            plus++;
        }
        
      }
      if(key - minus <= plus - key){
        System.out.println(minus);
      }
      else{
        System.out.println(plus);
      }
    }
    else{
      System.out.println(key);
    }
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int key = sc.nextInt();
    int num = sc.nextInt();
    if(num > 0){
      int map[] = new int[102];
      for(int i = 0;i < 102;i++){
        map[i] = 0;
      }
      for(int i = 0;i < num;i++){
        int n = sc.nextInt();
        map[n] = n;
      }
      int plus = key;
      int minus = key;
      while(map[plus] != 0 && map[minus] != 0){
        plus++;
        minus--;
        if(map[plus] == 0 && map[minus] == 0){
            break;
        }
        else if(map[plus] == 0){
            minus--;
        }
        else if(map[minus] == 0){
            plus++;
        }
        
      }
      if(key - minus <= plus - key){
        System.out.println(minus);
      }
      else{
        System.out.println(plus);
      }
    }
    else{
      System.out.println(key);
    }
  }
} Main
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int key = sc.nextInt();
    int num = sc.nextInt();
    if(num > 0){
      int map[] = new int[102];
      for(int i = 0;i < 102;i++){
        map[i] = 0;
      }
      for(int i = 0;i < num;i++){
        int n = sc.nextInt();
        map[n] = n;
      }
      int plus = key;
      int minus = key;
      while(map[plus] != 0 && map[minus] != 0){
        plus++;
        minus--;
        if(map[plus] == 0 && map[minus] == 0){
            break;
        }
        else if(map[plus] == 0){
            minus--;
        }
        else if(map[minus] == 0){
            plus++;
        }
        
      }
      if(key - minus <= plus - key){
        System.out.println(minus);
      }
      else{
        System.out.println(plus);
      }
    }
    else{
      System.out.println(key);
    }
  }
}