import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.StringTokenizer;

public class Main {
    public static void main(String []args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer(br.readLine());
        int x=Integer.parseInt(st.nextToken());
        int n=Integer.parseInt(st.nextToken());
        HashSet<Integer> num = new HashSet<>();
        int c=1;
        int temp1=x;
        int temp2=x;
        if(n==0){
            System.out.println(x);
        }
        else {
            st = new StringTokenizer(br.readLine());
            for (int i = 0; i < n; i++) {
                num.add(Integer.parseInt(st.nextToken()));
            }
            for(c=0;c<n+1;c++) {
                temp1 = x + c;
                temp2 = x - c;
                if (!num.contains(temp2)) {
                    System.out.println(temp2);
                    break;
                }
                if (!num.contains(temp1)) {
                    System.out.println(temp1);
                    break;
                }
            }

        }
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayList; ArrayList java.util import java.util.HashSet; HashSet java.util import java.util.StringTokenizer; StringTokenizer java.util public class Main {
    public static void main(String []args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer(br.readLine());
        int x=Integer.parseInt(st.nextToken());
        int n=Integer.parseInt(st.nextToken());
        HashSet<Integer> num = new HashSet<>();
        int c=1;
        int temp1=x;
        int temp2=x;
        if(n==0){
            System.out.println(x);
        }
        else {
            st = new StringTokenizer(br.readLine());
            for (int i = 0; i < n; i++) {
                num.add(Integer.parseInt(st.nextToken()));
            }
            for(c=0;c<n+1;c++) {
                temp1 = x + c;
                temp2 = x - c;
                if (!num.contains(temp2)) {
                    System.out.println(temp2);
                    break;
                }
                if (!num.contains(temp1)) {
                    System.out.println(temp1);
                    break;
                }
            }

        }
    }
} Main public static void main(String []args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer(br.readLine());
        int x=Integer.parseInt(st.nextToken());
        int n=Integer.parseInt(st.nextToken());
        HashSet<Integer> num = new HashSet<>();
        int c=1;
        int temp1=x;
        int temp2=x;
        if(n==0){
            System.out.println(x);
        }
        else {
            st = new StringTokenizer(br.readLine());
            for (int i = 0; i < n; i++) {
                num.add(Integer.parseInt(st.nextToken()));
            }
            for(c=0;c<n+1;c++) {
                temp1 = x + c;
                temp2 = x - c;
                if (!num.contains(temp2)) {
                    System.out.println(temp2);
                    break;
                }
                if (!num.contains(temp1)) {
                    System.out.println(temp1);
                    break;
                }
            }

        }
    } main {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer(br.readLine());
        int x=Integer.parseInt(st.nextToken());
        int n=Integer.parseInt(st.nextToken());
        HashSet<Integer> num = new HashSet<>();
        int c=1;
        int temp1=x;
        int temp2=x;
        if(n==0){
            System.out.println(x);
        }
        else {
            st = new StringTokenizer(br.readLine());
            for (int i = 0; i < n; i++) {
                num.add(Integer.parseInt(st.nextToken()));
            }
            for(c=0;c<n+1;c++) {
                temp1 = x + c;
                temp2 = x - c;
                if (!num.contains(temp2)) {
                    System.out.println(temp2);
                    break;
                }
                if (!num.contains(temp1)) {
                    System.out.println(temp1);
                    break;
                }
            }

        }
    } BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) StringTokenizer st=new StringTokenizer(br.readLine()); st new StringTokenizer(br.readLine()) int x=Integer.parseInt(st.nextToken()); x Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st int n=Integer.parseInt(st.nextToken()); n Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st HashSet<Integer> num = new HashSet<>(); num new HashSet<>() int c=1; c 1 int temp1=x; temp1 x int temp2=x; temp2 x if(n==0){
            System.out.println(x);
        }
        else {
            st = new StringTokenizer(br.readLine());
            for (int i = 0; i < n; i++) {
                num.add(Integer.parseInt(st.nextToken()));
            }
            for(c=0;c<n+1;c++) {
                temp1 = x + c;
                temp2 = x - c;
                if (!num.contains(temp2)) {
                    System.out.println(temp2);
                    break;
                }
                if (!num.contains(temp1)) {
                    System.out.println(temp1);
                    break;
                }
            }

        } n==0 n 0 {
            System.out.println(x);
        } System.out.println(x) System.out.println System.out System System.out x {
            st = new StringTokenizer(br.readLine());
            for (int i = 0; i < n; i++) {
                num.add(Integer.parseInt(st.nextToken()));
            }
            for(c=0;c<n+1;c++) {
                temp1 = x + c;
                temp2 = x - c;
                if (!num.contains(temp2)) {
                    System.out.println(temp2);
                    break;
                }
                if (!num.contains(temp1)) {
                    System.out.println(temp1);
                    break;
                }
            }

        } st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) for (int i = 0; i < n; i++) {
                num.add(Integer.parseInt(st.nextToken()));
            } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
                num.add(Integer.parseInt(st.nextToken()));
            } {
                num.add(Integer.parseInt(st.nextToken()));
            } num.add(Integer.parseInt(st.nextToken())) num.add num Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st for(c=0;c<n+1;c++) {
                temp1 = x + c;
                temp2 = x - c;
                if (!num.contains(temp2)) {
                    System.out.println(temp2);
                    break;
                }
                if (!num.contains(temp1)) {
                    System.out.println(temp1);
                    break;
                }
            } c=0; c=0 c 0 c<n+1 c n+1 n 1 c++ c++ c {
                temp1 = x + c;
                temp2 = x - c;
                if (!num.contains(temp2)) {
                    System.out.println(temp2);
                    break;
                }
                if (!num.contains(temp1)) {
                    System.out.println(temp1);
                    break;
                }
            } {
                temp1 = x + c;
                temp2 = x - c;
                if (!num.contains(temp2)) {
                    System.out.println(temp2);
                    break;
                }
                if (!num.contains(temp1)) {
                    System.out.println(temp1);
                    break;
                }
            } temp1 = x + c temp1 x + c x c temp2 = x - c temp2 x - c x c if (!num.contains(temp2)) {
                    System.out.println(temp2);
                    break;
                } !num.contains(temp2) num.contains(temp2) num.contains num temp2 {
                    System.out.println(temp2);
                    break;
                } System.out.println(temp2) System.out.println System.out System System.out temp2 break; if (!num.contains(temp1)) {
                    System.out.println(temp1);
                    break;
                } !num.contains(temp1) num.contains(temp1) num.contains num temp1 {
                    System.out.println(temp1);
                    break;
                } System.out.println(temp1) System.out.println System.out System System.out temp1 break; String []args args public class Main {
    public static void main(String []args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer(br.readLine());
        int x=Integer.parseInt(st.nextToken());
        int n=Integer.parseInt(st.nextToken());
        HashSet<Integer> num = new HashSet<>();
        int c=1;
        int temp1=x;
        int temp2=x;
        if(n==0){
            System.out.println(x);
        }
        else {
            st = new StringTokenizer(br.readLine());
            for (int i = 0; i < n; i++) {
                num.add(Integer.parseInt(st.nextToken()));
            }
            for(c=0;c<n+1;c++) {
                temp1 = x + c;
                temp2 = x - c;
                if (!num.contains(temp2)) {
                    System.out.println(temp2);
                    break;
                }
                if (!num.contains(temp1)) {
                    System.out.println(temp1);
                    break;
                }
            }

        }
    }
} public class Main {
    public static void main(String []args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer(br.readLine());
        int x=Integer.parseInt(st.nextToken());
        int n=Integer.parseInt(st.nextToken());
        HashSet<Integer> num = new HashSet<>();
        int c=1;
        int temp1=x;
        int temp2=x;
        if(n==0){
            System.out.println(x);
        }
        else {
            st = new StringTokenizer(br.readLine());
            for (int i = 0; i < n; i++) {
                num.add(Integer.parseInt(st.nextToken()));
            }
            for(c=0;c<n+1;c++) {
                temp1 = x + c;
                temp2 = x - c;
                if (!num.contains(temp2)) {
                    System.out.println(temp2);
                    break;
                }
                if (!num.contains(temp1)) {
                    System.out.println(temp1);
                    break;
                }
            }

        }
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.StringTokenizer;

public class Main {
    public static void main(String []args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer(br.readLine());
        int x=Integer.parseInt(st.nextToken());
        int n=Integer.parseInt(st.nextToken());
        HashSet<Integer> num = new HashSet<>();
        int c=1;
        int temp1=x;
        int temp2=x;
        if(n==0){
            System.out.println(x);
        }
        else {
            st = new StringTokenizer(br.readLine());
            for (int i = 0; i < n; i++) {
                num.add(Integer.parseInt(st.nextToken()));
            }
            for(c=0;c<n+1;c++) {
                temp1 = x + c;
                temp2 = x - c;
                if (!num.contains(temp2)) {
                    System.out.println(temp2);
                    break;
                }
                if (!num.contains(temp1)) {
                    System.out.println(temp1);
                    break;
                }
            }

        }
    }
}
