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();
      	if(N==0){
          System.out.println(String.valueOf(X));
          return;
        }
      
      List<Integer> forbits = new ArrayList<Integer>();
      for(int i=0;i<N;i++){
          forbits.add(sc.nextInt());
        }
      
      int diff = 0;
      int answer = 0;
      while(true){
        if(!forbits.contains(X-diff)){
          answer = X-diff;
          break;
        } else if(!forbits.contains(X+diff)){
          answer = X+diff;
          break;
        }
        diff++;
      }
      
      System.out.println(String.valueOf(answer));
    }
} 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();
      	if(N==0){
          System.out.println(String.valueOf(X));
          return;
        }
      
      List<Integer> forbits = new ArrayList<Integer>();
      for(int i=0;i<N;i++){
          forbits.add(sc.nextInt());
        }
      
      int diff = 0;
      int answer = 0;
      while(true){
        if(!forbits.contains(X-diff)){
          answer = X-diff;
          break;
        } else if(!forbits.contains(X+diff)){
          answer = X+diff;
          break;
        }
        diff++;
      }
      
      System.out.println(String.valueOf(answer));
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
      	if(N==0){
          System.out.println(String.valueOf(X));
          return;
        }
      
      List<Integer> forbits = new ArrayList<Integer>();
      for(int i=0;i<N;i++){
          forbits.add(sc.nextInt());
        }
      
      int diff = 0;
      int answer = 0;
      while(true){
        if(!forbits.contains(X-diff)){
          answer = X-diff;
          break;
        } else if(!forbits.contains(X+diff)){
          answer = X+diff;
          break;
        }
        diff++;
      }
      
      System.out.println(String.valueOf(answer));
    } main {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
      	if(N==0){
          System.out.println(String.valueOf(X));
          return;
        }
      
      List<Integer> forbits = new ArrayList<Integer>();
      for(int i=0;i<N;i++){
          forbits.add(sc.nextInt());
        }
      
      int diff = 0;
      int answer = 0;
      while(true){
        if(!forbits.contains(X-diff)){
          answer = X-diff;
          break;
        } else if(!forbits.contains(X+diff)){
          answer = X+diff;
          break;
        }
        diff++;
      }
      
      System.out.println(String.valueOf(answer));
    } 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 if(N==0){
          System.out.println(String.valueOf(X));
          return;
        } N==0 N 0 {
          System.out.println(String.valueOf(X));
          return;
        } System.out.println(String.valueOf(X)) System.out.println System.out System System.out String.valueOf(X) String.valueOf String X return; List<Integer> forbits = new ArrayList<Integer>(); forbits new ArrayList<Integer>() for(int i=0;i<N;i++){
          forbits.add(sc.nextInt());
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
          forbits.add(sc.nextInt());
        } {
          forbits.add(sc.nextInt());
        } forbits.add(sc.nextInt()) forbits.add forbits sc.nextInt() sc.nextInt sc int diff = 0; diff 0 int answer = 0; answer 0 while(true){
        if(!forbits.contains(X-diff)){
          answer = X-diff;
          break;
        } else if(!forbits.contains(X+diff)){
          answer = X+diff;
          break;
        }
        diff++;
      } true {
        if(!forbits.contains(X-diff)){
          answer = X-diff;
          break;
        } else if(!forbits.contains(X+diff)){
          answer = X+diff;
          break;
        }
        diff++;
      } if(!forbits.contains(X-diff)){
          answer = X-diff;
          break;
        } else if(!forbits.contains(X+diff)){
          answer = X+diff;
          break;
        } !forbits.contains(X-diff) forbits.contains(X-diff) forbits.contains forbits X-diff X diff {
          answer = X-diff;
          break;
        } answer = X-diff answer X-diff X diff break; if(!forbits.contains(X+diff)){
          answer = X+diff;
          break;
        } !forbits.contains(X+diff) forbits.contains(X+diff) forbits.contains forbits X+diff X diff {
          answer = X+diff;
          break;
        } answer = X+diff answer X+diff X diff break; diff++ diff System.out.println(String.valueOf(answer)) System.out.println System.out System System.out String.valueOf(answer) String.valueOf String answer 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();
      	if(N==0){
          System.out.println(String.valueOf(X));
          return;
        }
      
      List<Integer> forbits = new ArrayList<Integer>();
      for(int i=0;i<N;i++){
          forbits.add(sc.nextInt());
        }
      
      int diff = 0;
      int answer = 0;
      while(true){
        if(!forbits.contains(X-diff)){
          answer = X-diff;
          break;
        } else if(!forbits.contains(X+diff)){
          answer = X+diff;
          break;
        }
        diff++;
      }
      
      System.out.println(String.valueOf(answer));
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
      	if(N==0){
          System.out.println(String.valueOf(X));
          return;
        }
      
      List<Integer> forbits = new ArrayList<Integer>();
      for(int i=0;i<N;i++){
          forbits.add(sc.nextInt());
        }
      
      int diff = 0;
      int answer = 0;
      while(true){
        if(!forbits.contains(X-diff)){
          answer = X-diff;
          break;
        } else if(!forbits.contains(X+diff)){
          answer = X+diff;
          break;
        }
        diff++;
      }
      
      System.out.println(String.valueOf(answer));
    }
} 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();
      	if(N==0){
          System.out.println(String.valueOf(X));
          return;
        }
      
      List<Integer> forbits = new ArrayList<Integer>();
      for(int i=0;i<N;i++){
          forbits.add(sc.nextInt());
        }
      
      int diff = 0;
      int answer = 0;
      while(true){
        if(!forbits.contains(X-diff)){
          answer = X-diff;
          break;
        } else if(!forbits.contains(X+diff)){
          answer = X+diff;
          break;
        }
        diff++;
      }
      
      System.out.println(String.valueOf(answer));
    }
}