import java.util.*;
class Main {
    public static void main(String []args) {
        Scanner scn= new Scanner(System.in);
        int x= scn.nextInt();
        int n=scn.nextInt();
        int []arr= new int[n];
        HashSet<Integer> map= new HashSet<>();
        for(int i=0;i<n;i++){
            arr[i]=scn.nextInt();
            map.add(arr[i]);
        }
        int diff=0;
        while(true){
            int no=x-diff;
            if(!map.contains(no)){
                System.out.println(no);
                return;
            }
            no=x+diff;
            if(!map.contains(no)){
                System.out.println(no);
                return;
            }
            diff++;
        }
    }
} import java.util.*; util.* java class Main {
    public static void main(String []args) {
        Scanner scn= new Scanner(System.in);
        int x= scn.nextInt();
        int n=scn.nextInt();
        int []arr= new int[n];
        HashSet<Integer> map= new HashSet<>();
        for(int i=0;i<n;i++){
            arr[i]=scn.nextInt();
            map.add(arr[i]);
        }
        int diff=0;
        while(true){
            int no=x-diff;
            if(!map.contains(no)){
                System.out.println(no);
                return;
            }
            no=x+diff;
            if(!map.contains(no)){
                System.out.println(no);
                return;
            }
            diff++;
        }
    }
} Main public static void main(String []args) {
        Scanner scn= new Scanner(System.in);
        int x= scn.nextInt();
        int n=scn.nextInt();
        int []arr= new int[n];
        HashSet<Integer> map= new HashSet<>();
        for(int i=0;i<n;i++){
            arr[i]=scn.nextInt();
            map.add(arr[i]);
        }
        int diff=0;
        while(true){
            int no=x-diff;
            if(!map.contains(no)){
                System.out.println(no);
                return;
            }
            no=x+diff;
            if(!map.contains(no)){
                System.out.println(no);
                return;
            }
            diff++;
        }
    } main {
        Scanner scn= new Scanner(System.in);
        int x= scn.nextInt();
        int n=scn.nextInt();
        int []arr= new int[n];
        HashSet<Integer> map= new HashSet<>();
        for(int i=0;i<n;i++){
            arr[i]=scn.nextInt();
            map.add(arr[i]);
        }
        int diff=0;
        while(true){
            int no=x-diff;
            if(!map.contains(no)){
                System.out.println(no);
                return;
            }
            no=x+diff;
            if(!map.contains(no)){
                System.out.println(no);
                return;
            }
            diff++;
        }
    } Scanner scn= new Scanner(System.in); scn new Scanner(System.in) int x= scn.nextInt(); x scn.nextInt() scn.nextInt scn int n=scn.nextInt(); n scn.nextInt() scn.nextInt scn int []arr= new int[n]; arr new int[n] n HashSet<Integer> map= new HashSet<>(); map new HashSet<>() for(int i=0;i<n;i++){
            arr[i]=scn.nextInt();
            map.add(arr[i]);
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            arr[i]=scn.nextInt();
            map.add(arr[i]);
        } {
            arr[i]=scn.nextInt();
            map.add(arr[i]);
        } arr[i]=scn.nextInt() arr[i] arr i scn.nextInt() scn.nextInt scn map.add(arr[i]) map.add map arr[i] arr i int diff=0; diff 0 while(true){
            int no=x-diff;
            if(!map.contains(no)){
                System.out.println(no);
                return;
            }
            no=x+diff;
            if(!map.contains(no)){
                System.out.println(no);
                return;
            }
            diff++;
        } true {
            int no=x-diff;
            if(!map.contains(no)){
                System.out.println(no);
                return;
            }
            no=x+diff;
            if(!map.contains(no)){
                System.out.println(no);
                return;
            }
            diff++;
        } int no=x-diff; no x-diff x diff if(!map.contains(no)){
                System.out.println(no);
                return;
            } !map.contains(no) map.contains(no) map.contains map no {
                System.out.println(no);
                return;
            } System.out.println(no) System.out.println System.out System System.out no return; no=x+diff no x+diff x diff if(!map.contains(no)){
                System.out.println(no);
                return;
            } !map.contains(no) map.contains(no) map.contains map no {
                System.out.println(no);
                return;
            } System.out.println(no) System.out.println System.out System System.out no return; diff++ diff String []args args
import java.util.*;
class Main {
    public static void main(String []args) {
        Scanner scn= new Scanner(System.in);
        int x= scn.nextInt();
        int n=scn.nextInt();
        int []arr= new int[n];
        HashSet<Integer> map= new HashSet<>();
        for(int i=0;i<n;i++){
            arr[i]=scn.nextInt();
            map.add(arr[i]);
        }
        int diff=0;
        while(true){
            int no=x-diff;
            if(!map.contains(no)){
                System.out.println(no);
                return;
            }
            no=x+diff;
            if(!map.contains(no)){
                System.out.println(no);
                return;
            }
            diff++;
        }
    }
}