import java.util.Scanner;

public class Main {


    public static void main(String[] args) {


        Scanner sc = new Scanner(System.in);
        int x= sc.nextInt();
        int n = sc.nextInt();
        int p[] = new int[n];
        for(int i = 0;i<n;i++){
            p[i] = sc.nextInt();
        }
        int ans = 0;


        for(int i = 0;i<105;i++){
            int tmp = x + i;
            int tmpp = x - i;
            boolean tmplus  = true;
            boolean tmpminus = true;
            int j = 0;
            while (tmplus||tmpminus){
                if(j == n){
                    break;
                }
                if(p[j]==tmp){
                    tmplus =false;
                }
                if(p[j]==tmpp){
                    tmpminus = false;

                }

                j++;
            }
            if(tmplus&&tmpminus){
                System.out.println(x-i);
                System.exit(0);
            }
            else if(tmplus&&!tmpminus){
                System.out.println(x+i);
                System.exit(0);
            }
            else if(!tmplus&&tmpminus){
                System.out.println(x-i);
                System.exit(0);
            }



        }

    }

} import java.util.Scanner; Scanner 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();
        int p[] = new int[n];
        for(int i = 0;i<n;i++){
            p[i] = sc.nextInt();
        }
        int ans = 0;


        for(int i = 0;i<105;i++){
            int tmp = x + i;
            int tmpp = x - i;
            boolean tmplus  = true;
            boolean tmpminus = true;
            int j = 0;
            while (tmplus||tmpminus){
                if(j == n){
                    break;
                }
                if(p[j]==tmp){
                    tmplus =false;
                }
                if(p[j]==tmpp){
                    tmpminus = false;

                }

                j++;
            }
            if(tmplus&&tmpminus){
                System.out.println(x-i);
                System.exit(0);
            }
            else if(tmplus&&!tmpminus){
                System.out.println(x+i);
                System.exit(0);
            }
            else if(!tmplus&&tmpminus){
                System.out.println(x-i);
                System.exit(0);
            }



        }

    }

} Main public static void main(String[] args) {


        Scanner sc = new Scanner(System.in);
        int x= sc.nextInt();
        int n = sc.nextInt();
        int p[] = new int[n];
        for(int i = 0;i<n;i++){
            p[i] = sc.nextInt();
        }
        int ans = 0;


        for(int i = 0;i<105;i++){
            int tmp = x + i;
            int tmpp = x - i;
            boolean tmplus  = true;
            boolean tmpminus = true;
            int j = 0;
            while (tmplus||tmpminus){
                if(j == n){
                    break;
                }
                if(p[j]==tmp){
                    tmplus =false;
                }
                if(p[j]==tmpp){
                    tmpminus = false;

                }

                j++;
            }
            if(tmplus&&tmpminus){
                System.out.println(x-i);
                System.exit(0);
            }
            else if(tmplus&&!tmpminus){
                System.out.println(x+i);
                System.exit(0);
            }
            else if(!tmplus&&tmpminus){
                System.out.println(x-i);
                System.exit(0);
            }



        }

    } main {


        Scanner sc = new Scanner(System.in);
        int x= sc.nextInt();
        int n = sc.nextInt();
        int p[] = new int[n];
        for(int i = 0;i<n;i++){
            p[i] = sc.nextInt();
        }
        int ans = 0;


        for(int i = 0;i<105;i++){
            int tmp = x + i;
            int tmpp = x - i;
            boolean tmplus  = true;
            boolean tmpminus = true;
            int j = 0;
            while (tmplus||tmpminus){
                if(j == n){
                    break;
                }
                if(p[j]==tmp){
                    tmplus =false;
                }
                if(p[j]==tmpp){
                    tmpminus = false;

                }

                j++;
            }
            if(tmplus&&tmpminus){
                System.out.println(x-i);
                System.exit(0);
            }
            else if(tmplus&&!tmpminus){
                System.out.println(x+i);
                System.exit(0);
            }
            else if(!tmplus&&tmpminus){
                System.out.println(x-i);
                System.exit(0);
            }



        }

    } 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 int p[] = new int[n]; p new int[n] n for(int i = 0;i<n;i++){
            p[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
            p[i] = sc.nextInt();
        } {
            p[i] = sc.nextInt();
        } p[i] = sc.nextInt() p[i] p i sc.nextInt() sc.nextInt sc int ans = 0; ans 0 for(int i = 0;i<105;i++){
            int tmp = x + i;
            int tmpp = x - i;
            boolean tmplus  = true;
            boolean tmpminus = true;
            int j = 0;
            while (tmplus||tmpminus){
                if(j == n){
                    break;
                }
                if(p[j]==tmp){
                    tmplus =false;
                }
                if(p[j]==tmpp){
                    tmpminus = false;

                }

                j++;
            }
            if(tmplus&&tmpminus){
                System.out.println(x-i);
                System.exit(0);
            }
            else if(tmplus&&!tmpminus){
                System.out.println(x+i);
                System.exit(0);
            }
            else if(!tmplus&&tmpminus){
                System.out.println(x-i);
                System.exit(0);
            }



        } int i = 0; int i = 0; i 0 i<105 i 105 i++ i++ i {
            int tmp = x + i;
            int tmpp = x - i;
            boolean tmplus  = true;
            boolean tmpminus = true;
            int j = 0;
            while (tmplus||tmpminus){
                if(j == n){
                    break;
                }
                if(p[j]==tmp){
                    tmplus =false;
                }
                if(p[j]==tmpp){
                    tmpminus = false;

                }

                j++;
            }
            if(tmplus&&tmpminus){
                System.out.println(x-i);
                System.exit(0);
            }
            else if(tmplus&&!tmpminus){
                System.out.println(x+i);
                System.exit(0);
            }
            else if(!tmplus&&tmpminus){
                System.out.println(x-i);
                System.exit(0);
            }



        } {
            int tmp = x + i;
            int tmpp = x - i;
            boolean tmplus  = true;
            boolean tmpminus = true;
            int j = 0;
            while (tmplus||tmpminus){
                if(j == n){
                    break;
                }
                if(p[j]==tmp){
                    tmplus =false;
                }
                if(p[j]==tmpp){
                    tmpminus = false;

                }

                j++;
            }
            if(tmplus&&tmpminus){
                System.out.println(x-i);
                System.exit(0);
            }
            else if(tmplus&&!tmpminus){
                System.out.println(x+i);
                System.exit(0);
            }
            else if(!tmplus&&tmpminus){
                System.out.println(x-i);
                System.exit(0);
            }



        } int tmp = x + i; tmp x + i x i int tmpp = x - i; tmpp x - i x i boolean tmplus  = true; tmplus true boolean tmpminus = true; tmpminus true int j = 0; j 0 while (tmplus||tmpminus){
                if(j == n){
                    break;
                }
                if(p[j]==tmp){
                    tmplus =false;
                }
                if(p[j]==tmpp){
                    tmpminus = false;

                }

                j++;
            } tmplus||tmpminus tmplus tmpminus {
                if(j == n){
                    break;
                }
                if(p[j]==tmp){
                    tmplus =false;
                }
                if(p[j]==tmpp){
                    tmpminus = false;

                }

                j++;
            } if(j == n){
                    break;
                } j == n j n {
                    break;
                } break; if(p[j]==tmp){
                    tmplus =false;
                } p[j]==tmp p[j] p j tmp {
                    tmplus =false;
                } tmplus =false tmplus false if(p[j]==tmpp){
                    tmpminus = false;

                } p[j]==tmpp p[j] p j tmpp {
                    tmpminus = false;

                } tmpminus = false tmpminus false j++ j if(tmplus&&tmpminus){
                System.out.println(x-i);
                System.exit(0);
            }
            else if(tmplus&&!tmpminus){
                System.out.println(x+i);
                System.exit(0);
            }
            else if(!tmplus&&tmpminus){
                System.out.println(x-i);
                System.exit(0);
            } tmplus&&tmpminus tmplus tmpminus {
                System.out.println(x-i);
                System.exit(0);
            } System.out.println(x-i) System.out.println System.out System System.out x-i x i System.exit(0) System.exit System 0 if(tmplus&&!tmpminus){
                System.out.println(x+i);
                System.exit(0);
            }
            else if(!tmplus&&tmpminus){
                System.out.println(x-i);
                System.exit(0);
            } tmplus&&!tmpminus tmplus !tmpminus tmpminus {
                System.out.println(x+i);
                System.exit(0);
            } System.out.println(x+i) System.out.println System.out System System.out x+i x i System.exit(0) System.exit System 0 if(!tmplus&&tmpminus){
                System.out.println(x-i);
                System.exit(0);
            } !tmplus&&tmpminus !tmplus tmplus tmpminus {
                System.out.println(x-i);
                System.exit(0);
            } System.out.println(x-i) System.out.println System.out System System.out x-i x i System.exit(0) System.exit System 0 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();
        int p[] = new int[n];
        for(int i = 0;i<n;i++){
            p[i] = sc.nextInt();
        }
        int ans = 0;


        for(int i = 0;i<105;i++){
            int tmp = x + i;
            int tmpp = x - i;
            boolean tmplus  = true;
            boolean tmpminus = true;
            int j = 0;
            while (tmplus||tmpminus){
                if(j == n){
                    break;
                }
                if(p[j]==tmp){
                    tmplus =false;
                }
                if(p[j]==tmpp){
                    tmpminus = false;

                }

                j++;
            }
            if(tmplus&&tmpminus){
                System.out.println(x-i);
                System.exit(0);
            }
            else if(tmplus&&!tmpminus){
                System.out.println(x+i);
                System.exit(0);
            }
            else if(!tmplus&&tmpminus){
                System.out.println(x-i);
                System.exit(0);
            }



        }

    }

} public class Main {


    public static void main(String[] args) {


        Scanner sc = new Scanner(System.in);
        int x= sc.nextInt();
        int n = sc.nextInt();
        int p[] = new int[n];
        for(int i = 0;i<n;i++){
            p[i] = sc.nextInt();
        }
        int ans = 0;


        for(int i = 0;i<105;i++){
            int tmp = x + i;
            int tmpp = x - i;
            boolean tmplus  = true;
            boolean tmpminus = true;
            int j = 0;
            while (tmplus||tmpminus){
                if(j == n){
                    break;
                }
                if(p[j]==tmp){
                    tmplus =false;
                }
                if(p[j]==tmpp){
                    tmpminus = false;

                }

                j++;
            }
            if(tmplus&&tmpminus){
                System.out.println(x-i);
                System.exit(0);
            }
            else if(tmplus&&!tmpminus){
                System.out.println(x+i);
                System.exit(0);
            }
            else if(!tmplus&&tmpminus){
                System.out.println(x-i);
                System.exit(0);
            }



        }

    }

} Main
import java.util.Scanner;

public class Main {


    public static void main(String[] args) {


        Scanner sc = new Scanner(System.in);
        int x= sc.nextInt();
        int n = sc.nextInt();
        int p[] = new int[n];
        for(int i = 0;i<n;i++){
            p[i] = sc.nextInt();
        }
        int ans = 0;


        for(int i = 0;i<105;i++){
            int tmp = x + i;
            int tmpp = x - i;
            boolean tmplus  = true;
            boolean tmpminus = true;
            int j = 0;
            while (tmplus||tmpminus){
                if(j == n){
                    break;
                }
                if(p[j]==tmp){
                    tmplus =false;
                }
                if(p[j]==tmpp){
                    tmpminus = false;

                }

                j++;
            }
            if(tmplus&&tmpminus){
                System.out.println(x-i);
                System.exit(0);
            }
            else if(tmplus&&!tmpminus){
                System.out.println(x+i);
                System.exit(0);
            }
            else if(!tmplus&&tmpminus){
                System.out.println(x-i);
                System.exit(0);
            }



        }

    }

}
