import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.nio.charset.IllegalCharsetNameException;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        OutputStream outputStream = System.out;
        PrintWriter out = new PrintWriter(outputStream);
        FastReader in = new FastReader();
        test a=new test();
        a.solve(in,out);
        out.close();
    }
}

class test {
    public void solve(FastReader in, PrintWriter out) {
        int x =in.nextInt();
        int n=in.nextInt();
        ArrayList<Integer> my =new ArrayList<>();
        for(int i=0;i<n;i++){
            my.add(in.nextInt());
        }
        Collections.sort(my);
        if(n==0){
            out.println(x);
        }
        
        else if(!my.contains(x)){
            out.println(x);
        }
        else{
            int k=x;int i=1;
            while(true){
                if(!my.contains(k-i)){
                    k=k-i;
                    break;
                }
                else if(!my.contains(k+i)){
                    k=k+i;
                    break;
                }
                i++;
            }
            out.println(k);
        }
    }
}

class FastReader{
    BufferedReader br;
    StringTokenizer st;

    public FastReader(){
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next(){
        while(st==null || !st.hasMoreElements()){
            try{
                st=new StringTokenizer(br.readLine());
            }
            catch(IOException e){
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt(){
        return Integer.parseInt(next());
    }

    Long nextLong(){
        return Long.parseLong(next());
    }

    double nextDouble(){
        return Double.parseDouble(next());
    }
    String nextLine(){
        String str="";
        try{
            str=br.readLine();
        }
        catch(IOException e){
            e.printStackTrace();
        }
        return str;
    }
} import java.io.*; io.* java import java.lang.reflect.Array; Array java.lang.reflect import java.math.BigInteger; BigInteger java.math import java.nio.charset.IllegalCharsetNameException; IllegalCharsetNameException java.nio.charset import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws IOException {
        OutputStream outputStream = System.out;
        PrintWriter out = new PrintWriter(outputStream);
        FastReader in = new FastReader();
        test a=new test();
        a.solve(in,out);
        out.close();
    }
} Main public static void main(String[] args) throws IOException {
        OutputStream outputStream = System.out;
        PrintWriter out = new PrintWriter(outputStream);
        FastReader in = new FastReader();
        test a=new test();
        a.solve(in,out);
        out.close();
    } main {
        OutputStream outputStream = System.out;
        PrintWriter out = new PrintWriter(outputStream);
        FastReader in = new FastReader();
        test a=new test();
        a.solve(in,out);
        out.close();
    } OutputStream outputStream = System.out; outputStream System.out System System.out PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) FastReader in = new FastReader(); in new FastReader() test a=new test(); a new test() a.solve(in,out) a.solve a in out out.close() out.close out String[] args args class test {
    public void solve(FastReader in, PrintWriter out) {
        int x =in.nextInt();
        int n=in.nextInt();
        ArrayList<Integer> my =new ArrayList<>();
        for(int i=0;i<n;i++){
            my.add(in.nextInt());
        }
        Collections.sort(my);
        if(n==0){
            out.println(x);
        }
        
        else if(!my.contains(x)){
            out.println(x);
        }
        else{
            int k=x;int i=1;
            while(true){
                if(!my.contains(k-i)){
                    k=k-i;
                    break;
                }
                else if(!my.contains(k+i)){
                    k=k+i;
                    break;
                }
                i++;
            }
            out.println(k);
        }
    }
} test public void solve(FastReader in, PrintWriter out) {
        int x =in.nextInt();
        int n=in.nextInt();
        ArrayList<Integer> my =new ArrayList<>();
        for(int i=0;i<n;i++){
            my.add(in.nextInt());
        }
        Collections.sort(my);
        if(n==0){
            out.println(x);
        }
        
        else if(!my.contains(x)){
            out.println(x);
        }
        else{
            int k=x;int i=1;
            while(true){
                if(!my.contains(k-i)){
                    k=k-i;
                    break;
                }
                else if(!my.contains(k+i)){
                    k=k+i;
                    break;
                }
                i++;
            }
            out.println(k);
        }
    } solve {
        int x =in.nextInt();
        int n=in.nextInt();
        ArrayList<Integer> my =new ArrayList<>();
        for(int i=0;i<n;i++){
            my.add(in.nextInt());
        }
        Collections.sort(my);
        if(n==0){
            out.println(x);
        }
        
        else if(!my.contains(x)){
            out.println(x);
        }
        else{
            int k=x;int i=1;
            while(true){
                if(!my.contains(k-i)){
                    k=k-i;
                    break;
                }
                else if(!my.contains(k+i)){
                    k=k+i;
                    break;
                }
                i++;
            }
            out.println(k);
        }
    } int x =in.nextInt(); x in.nextInt() in.nextInt in int n=in.nextInt(); n in.nextInt() in.nextInt in ArrayList<Integer> my =new ArrayList<>(); my new ArrayList<>() for(int i=0;i<n;i++){
            my.add(in.nextInt());
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            my.add(in.nextInt());
        } {
            my.add(in.nextInt());
        } my.add(in.nextInt()) my.add my in.nextInt() in.nextInt in Collections.sort(my) Collections.sort Collections my if(n==0){
            out.println(x);
        }
        
        else if(!my.contains(x)){
            out.println(x);
        }
        else{
            int k=x;int i=1;
            while(true){
                if(!my.contains(k-i)){
                    k=k-i;
                    break;
                }
                else if(!my.contains(k+i)){
                    k=k+i;
                    break;
                }
                i++;
            }
            out.println(k);
        } n==0 n 0 {
            out.println(x);
        } out.println(x) out.println out x if(!my.contains(x)){
            out.println(x);
        }
        else{
            int k=x;int i=1;
            while(true){
                if(!my.contains(k-i)){
                    k=k-i;
                    break;
                }
                else if(!my.contains(k+i)){
                    k=k+i;
                    break;
                }
                i++;
            }
            out.println(k);
        } !my.contains(x) my.contains(x) my.contains my x {
            out.println(x);
        } out.println(x) out.println out x {
            int k=x;int i=1;
            while(true){
                if(!my.contains(k-i)){
                    k=k-i;
                    break;
                }
                else if(!my.contains(k+i)){
                    k=k+i;
                    break;
                }
                i++;
            }
            out.println(k);
        } int k=x; k x int i=1; i 1 while(true){
                if(!my.contains(k-i)){
                    k=k-i;
                    break;
                }
                else if(!my.contains(k+i)){
                    k=k+i;
                    break;
                }
                i++;
            } true {
                if(!my.contains(k-i)){
                    k=k-i;
                    break;
                }
                else if(!my.contains(k+i)){
                    k=k+i;
                    break;
                }
                i++;
            } if(!my.contains(k-i)){
                    k=k-i;
                    break;
                }
                else if(!my.contains(k+i)){
                    k=k+i;
                    break;
                } !my.contains(k-i) my.contains(k-i) my.contains my k-i k i {
                    k=k-i;
                    break;
                } k=k-i k k-i k i break; if(!my.contains(k+i)){
                    k=k+i;
                    break;
                } !my.contains(k+i) my.contains(k+i) my.contains my k+i k i {
                    k=k+i;
                    break;
                } k=k+i k k+i k i break; i++ i out.println(k) out.println out k FastReader in in PrintWriter out out class FastReader{
    BufferedReader br;
    StringTokenizer st;

    public FastReader(){
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next(){
        while(st==null || !st.hasMoreElements()){
            try{
                st=new StringTokenizer(br.readLine());
            }
            catch(IOException e){
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt(){
        return Integer.parseInt(next());
    }

    Long nextLong(){
        return Long.parseLong(next());
    }

    double nextDouble(){
        return Double.parseDouble(next());
    }
    String nextLine(){
        String str="";
        try{
            str=br.readLine();
        }
        catch(IOException e){
            e.printStackTrace();
        }
        return str;
    }
} FastReader BufferedReader br; br StringTokenizer st; st public FastReader(){
        br = new BufferedReader(new InputStreamReader(System.in));
    } FastReader {
        br = new BufferedReader(new InputStreamReader(System.in));
    } br = new BufferedReader(new InputStreamReader(System.in)) br new BufferedReader(new InputStreamReader(System.in)) String next(){
        while(st==null || !st.hasMoreElements()){
            try{
                st=new StringTokenizer(br.readLine());
            }
            catch(IOException e){
                e.printStackTrace();
            }
        }
        return st.nextToken();
    } next {
        while(st==null || !st.hasMoreElements()){
            try{
                st=new StringTokenizer(br.readLine());
            }
            catch(IOException e){
                e.printStackTrace();
            }
        }
        return st.nextToken();
    } while(st==null || !st.hasMoreElements()){
            try{
                st=new StringTokenizer(br.readLine());
            }
            catch(IOException e){
                e.printStackTrace();
            }
        } st==null || !st.hasMoreElements() st==null st null !st.hasMoreElements() st.hasMoreElements() st.hasMoreElements st {
            try{
                st=new StringTokenizer(br.readLine());
            }
            catch(IOException e){
                e.printStackTrace();
            }
        } try{
                st=new StringTokenizer(br.readLine());
            }
            catch(IOException e){
                e.printStackTrace();
            } catch(IOException e){
                e.printStackTrace();
            } IOException e {
                e.printStackTrace();
            } e.printStackTrace() e.printStackTrace e {
                st=new StringTokenizer(br.readLine());
            } st=new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st int nextInt(){
        return Integer.parseInt(next());
    } nextInt {
        return Integer.parseInt(next());
    } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next Long nextLong(){
        return Long.parseLong(next());
    } nextLong {
        return Long.parseLong(next());
    } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next double nextDouble(){
        return Double.parseDouble(next());
    } nextDouble {
        return Double.parseDouble(next());
    } return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next String nextLine(){
        String str="";
        try{
            str=br.readLine();
        }
        catch(IOException e){
            e.printStackTrace();
        }
        return str;
    } nextLine {
        String str="";
        try{
            str=br.readLine();
        }
        catch(IOException e){
            e.printStackTrace();
        }
        return str;
    } String str=""; str "" try{
            str=br.readLine();
        }
        catch(IOException e){
            e.printStackTrace();
        } catch(IOException e){
            e.printStackTrace();
        } IOException e {
            e.printStackTrace();
        } e.printStackTrace() e.printStackTrace e {
            str=br.readLine();
        } str=br.readLine() str br.readLine() br.readLine br return str; str public class Main {
    public static void main(String[] args) throws IOException {
        OutputStream outputStream = System.out;
        PrintWriter out = new PrintWriter(outputStream);
        FastReader in = new FastReader();
        test a=new test();
        a.solve(in,out);
        out.close();
    }
} public class Main {
    public static void main(String[] args) throws IOException {
        OutputStream outputStream = System.out;
        PrintWriter out = new PrintWriter(outputStream);
        FastReader in = new FastReader();
        test a=new test();
        a.solve(in,out);
        out.close();
    }
} Main
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.nio.charset.IllegalCharsetNameException;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        OutputStream outputStream = System.out;
        PrintWriter out = new PrintWriter(outputStream);
        FastReader in = new FastReader();
        test a=new test();
        a.solve(in,out);
        out.close();
    }
}

class test {
    public void solve(FastReader in, PrintWriter out) {
        int x =in.nextInt();
        int n=in.nextInt();
        ArrayList<Integer> my =new ArrayList<>();
        for(int i=0;i<n;i++){
            my.add(in.nextInt());
        }
        Collections.sort(my);
        if(n==0){
            out.println(x);
        }
        
        else if(!my.contains(x)){
            out.println(x);
        }
        else{
            int k=x;int i=1;
            while(true){
                if(!my.contains(k-i)){
                    k=k-i;
                    break;
                }
                else if(!my.contains(k+i)){
                    k=k+i;
                    break;
                }
                i++;
            }
            out.println(k);
        }
    }
}

class FastReader{
    BufferedReader br;
    StringTokenizer st;

    public FastReader(){
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next(){
        while(st==null || !st.hasMoreElements()){
            try{
                st=new StringTokenizer(br.readLine());
            }
            catch(IOException e){
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt(){
        return Integer.parseInt(next());
    }

    Long nextLong(){
        return Long.parseLong(next());
    }

    double nextDouble(){
        return Double.parseDouble(next());
    }
    String nextLine(){
        String str="";
        try{
            str=br.readLine();
        }
        catch(IOException e){
            e.printStackTrace();
        }
        return str;
    }
}