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();
        if(n == 0) {
            System.out.println(x);
            return;
        }
        int[]p = new int [101];
        for(int i=0; i<n; i++) {
            p[sc.nextInt()] = 1;
        }
        for(int i=0; i<101; i++) {
            if(x-i >= 0) {
                if(0 == p[x-i]) {
                    System.out.println(x-i);
                    return;
                }
            } else {
                System.out.println(-1);
                return;
            }
            if(x+i <101) {
                if(0 == p[x+i]) {
                    System.out.println(x+i);
                    return;
                }
            }else {
                System.out.println(101);
                return;
            }
        }
    }
} 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();
        if(n == 0) {
            System.out.println(x);
            return;
        }
        int[]p = new int [101];
        for(int i=0; i<n; i++) {
            p[sc.nextInt()] = 1;
        }
        for(int i=0; i<101; i++) {
            if(x-i >= 0) {
                if(0 == p[x-i]) {
                    System.out.println(x-i);
                    return;
                }
            } else {
                System.out.println(-1);
                return;
            }
            if(x+i <101) {
                if(0 == p[x+i]) {
                    System.out.println(x+i);
                    return;
                }
            }else {
                System.out.println(101);
                return;
            }
        }
    }
} 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(x);
            return;
        }
        int[]p = new int [101];
        for(int i=0; i<n; i++) {
            p[sc.nextInt()] = 1;
        }
        for(int i=0; i<101; i++) {
            if(x-i >= 0) {
                if(0 == p[x-i]) {
                    System.out.println(x-i);
                    return;
                }
            } else {
                System.out.println(-1);
                return;
            }
            if(x+i <101) {
                if(0 == p[x+i]) {
                    System.out.println(x+i);
                    return;
                }
            }else {
                System.out.println(101);
                return;
            }
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        if(n == 0) {
            System.out.println(x);
            return;
        }
        int[]p = new int [101];
        for(int i=0; i<n; i++) {
            p[sc.nextInt()] = 1;
        }
        for(int i=0; i<101; i++) {
            if(x-i >= 0) {
                if(0 == p[x-i]) {
                    System.out.println(x-i);
                    return;
                }
            } else {
                System.out.println(-1);
                return;
            }
            if(x+i <101) {
                if(0 == p[x+i]) {
                    System.out.println(x+i);
                    return;
                }
            }else {
                System.out.println(101);
                return;
            }
        }
    } 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(x);
            return;
        } n == 0 n 0 {
            System.out.println(x);
            return;
        } System.out.println(x) System.out.println System.out System System.out x return; int[]p = new int [101]; p new int [101] 101 for(int i=0; i<n; i++) {
            p[sc.nextInt()] = 1;
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            p[sc.nextInt()] = 1;
        } {
            p[sc.nextInt()] = 1;
        } p[sc.nextInt()] = 1 p[sc.nextInt()] p sc.nextInt() sc.nextInt sc 1 for(int i=0; i<101; i++) {
            if(x-i >= 0) {
                if(0 == p[x-i]) {
                    System.out.println(x-i);
                    return;
                }
            } else {
                System.out.println(-1);
                return;
            }
            if(x+i <101) {
                if(0 == p[x+i]) {
                    System.out.println(x+i);
                    return;
                }
            }else {
                System.out.println(101);
                return;
            }
        } int i=0; int i=0; i 0 i<101 i 101 i++ i++ i {
            if(x-i >= 0) {
                if(0 == p[x-i]) {
                    System.out.println(x-i);
                    return;
                }
            } else {
                System.out.println(-1);
                return;
            }
            if(x+i <101) {
                if(0 == p[x+i]) {
                    System.out.println(x+i);
                    return;
                }
            }else {
                System.out.println(101);
                return;
            }
        } {
            if(x-i >= 0) {
                if(0 == p[x-i]) {
                    System.out.println(x-i);
                    return;
                }
            } else {
                System.out.println(-1);
                return;
            }
            if(x+i <101) {
                if(0 == p[x+i]) {
                    System.out.println(x+i);
                    return;
                }
            }else {
                System.out.println(101);
                return;
            }
        } if(x-i >= 0) {
                if(0 == p[x-i]) {
                    System.out.println(x-i);
                    return;
                }
            } else {
                System.out.println(-1);
                return;
            } x-i >= 0 x-i x i 0 {
                if(0 == p[x-i]) {
                    System.out.println(x-i);
                    return;
                }
            } if(0 == p[x-i]) {
                    System.out.println(x-i);
                    return;
                } 0 == p[x-i] 0 p[x-i] p x-i x i {
                    System.out.println(x-i);
                    return;
                } System.out.println(x-i) System.out.println System.out System System.out x-i x i return; {
                System.out.println(-1);
                return;
            } System.out.println(-1) System.out.println System.out System System.out -1 1 return; if(x+i <101) {
                if(0 == p[x+i]) {
                    System.out.println(x+i);
                    return;
                }
            }else {
                System.out.println(101);
                return;
            } x+i <101 x+i x i 101 {
                if(0 == p[x+i]) {
                    System.out.println(x+i);
                    return;
                }
            } if(0 == p[x+i]) {
                    System.out.println(x+i);
                    return;
                } 0 == p[x+i] 0 p[x+i] p x+i x i {
                    System.out.println(x+i);
                    return;
                } System.out.println(x+i) System.out.println System.out System System.out x+i x i return; {
                System.out.println(101);
                return;
            } System.out.println(101) System.out.println System.out System System.out 101 return; 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(x);
            return;
        }
        int[]p = new int [101];
        for(int i=0; i<n; i++) {
            p[sc.nextInt()] = 1;
        }
        for(int i=0; i<101; i++) {
            if(x-i >= 0) {
                if(0 == p[x-i]) {
                    System.out.println(x-i);
                    return;
                }
            } else {
                System.out.println(-1);
                return;
            }
            if(x+i <101) {
                if(0 == p[x+i]) {
                    System.out.println(x+i);
                    return;
                }
            }else {
                System.out.println(101);
                return;
            }
        }
    }
} 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(x);
            return;
        }
        int[]p = new int [101];
        for(int i=0; i<n; i++) {
            p[sc.nextInt()] = 1;
        }
        for(int i=0; i<101; i++) {
            if(x-i >= 0) {
                if(0 == p[x-i]) {
                    System.out.println(x-i);
                    return;
                }
            } else {
                System.out.println(-1);
                return;
            }
            if(x+i <101) {
                if(0 == p[x+i]) {
                    System.out.println(x+i);
                    return;
                }
            }else {
                System.out.println(101);
                return;
            }
        }
    }
} 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();
        if(n == 0) {
            System.out.println(x);
            return;
        }
        int[]p = new int [101];
        for(int i=0; i<n; i++) {
            p[sc.nextInt()] = 1;
        }
        for(int i=0; i<101; i++) {
            if(x-i >= 0) {
                if(0 == p[x-i]) {
                    System.out.println(x-i);
                    return;
                }
            } else {
                System.out.println(-1);
                return;
            }
            if(x+i <101) {
                if(0 == p[x+i]) {
                    System.out.println(x+i);
                    return;
                }
            }else {
                System.out.println(101);
                return;
            }
        }
    }
}