import 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[] Pz = new int[1000];
        for (int i = 0; i < N; i++){
            Pz[sc.nextInt()] = 1;
        }
//        Pz.sort();
        int ans = 0;
        for (int i = 0; i < 101; i++){

            if (Pz[X - i] != 1){
                ans = X - i;
                break;
            }
//            if (X + i > 100){
//                continue;
//            }
            if (Pz[X + i] != 1){
                ans = X + i;
                break;
            }
        }
        System.out.println(ans);
    }
} import java.util.*; util.* java public class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
        int[] Pz = new int[1000];
        for (int i = 0; i < N; i++){
            Pz[sc.nextInt()] = 1;
        }
//        Pz.sort();
        int ans = 0;
        for (int i = 0; i < 101; i++){

            if (Pz[X - i] != 1){
                ans = X - i;
                break;
            }
//            if (X + i > 100){
//                continue;
//            }
            if (Pz[X + i] != 1){
                ans = X + i;
                break;
            }
        }
        System.out.println(ans);
    }
} Main public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
        int[] Pz = new int[1000];
        for (int i = 0; i < N; i++){
            Pz[sc.nextInt()] = 1;
        }
//        Pz.sort();
        int ans = 0;
        for (int i = 0; i < 101; i++){

            if (Pz[X - i] != 1){
                ans = X - i;
                break;
            }
//            if (X + i > 100){
//                continue;
//            }
            if (Pz[X + i] != 1){
                ans = X + i;
                break;
            }
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
        int[] Pz = new int[1000];
        for (int i = 0; i < N; i++){
            Pz[sc.nextInt()] = 1;
        }
//        Pz.sort();
        int ans = 0;
        for (int i = 0; i < 101; i++){

            if (Pz[X - i] != 1){
                ans = X - i;
                break;
            }
//            if (X + i > 100){
//                continue;
//            }
            if (Pz[X + i] != 1){
                ans = X + i;
                break;
            }
        }
        System.out.println(ans);
    } 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[] Pz = new int[1000]; Pz new int[1000] 1000 for (int i = 0; i < N; i++){
            Pz[sc.nextInt()] = 1;
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            Pz[sc.nextInt()] = 1;
        } {
            Pz[sc.nextInt()] = 1;
        } Pz[sc.nextInt()] = 1 Pz[sc.nextInt()] Pz sc.nextInt() sc.nextInt sc 1 int ans = 0; ans 0 for (int i = 0; i < 101; i++){

            if (Pz[X - i] != 1){
                ans = X - i;
                break;
            }
//            if (X + i > 100){
//                continue;
//            }
            if (Pz[X + i] != 1){
                ans = X + i;
                break;
            }
        } int i = 0; int i = 0; i 0 i < 101 i 101 i++ i++ i {

            if (Pz[X - i] != 1){
                ans = X - i;
                break;
            }
//            if (X + i > 100){
//                continue;
//            }
            if (Pz[X + i] != 1){
                ans = X + i;
                break;
            }
        } {

            if (Pz[X - i] != 1){
                ans = X - i;
                break;
            }
//            if (X + i > 100){
//                continue;
//            }
            if (Pz[X + i] != 1){
                ans = X + i;
                break;
            }
        } if (Pz[X - i] != 1){
                ans = X - i;
                break;
            } Pz[X - i] != 1 Pz[X - i] Pz X - i X i 1 {
                ans = X - i;
                break;
            } ans = X - i ans X - i X i break; if (Pz[X + i] != 1){
                ans = X + i;
                break;
            } Pz[X + i] != 1 Pz[X + i] Pz X + i X i 1 {
                ans = X + i;
                break;
            } ans = X + i ans X + i X i break; System.out.println(ans) System.out.println System.out System System.out ans 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[] Pz = new int[1000];
        for (int i = 0; i < N; i++){
            Pz[sc.nextInt()] = 1;
        }
//        Pz.sort();
        int ans = 0;
        for (int i = 0; i < 101; i++){

            if (Pz[X - i] != 1){
                ans = X - i;
                break;
            }
//            if (X + i > 100){
//                continue;
//            }
            if (Pz[X + i] != 1){
                ans = X + i;
                break;
            }
        }
        System.out.println(ans);
    }
} public class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
        int[] Pz = new int[1000];
        for (int i = 0; i < N; i++){
            Pz[sc.nextInt()] = 1;
        }
//        Pz.sort();
        int ans = 0;
        for (int i = 0; i < 101; i++){

            if (Pz[X - i] != 1){
                ans = X - i;
                break;
            }
//            if (X + i > 100){
//                continue;
//            }
            if (Pz[X + i] != 1){
                ans = X + i;
                break;
            }
        }
        System.out.println(ans);
    }
} Main
import 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[] Pz = new int[1000];
        for (int i = 0; i < N; i++){
            Pz[sc.nextInt()] = 1;
        }
//        Pz.sort();
        int ans = 0;
        for (int i = 0; i < 101; i++){

            if (Pz[X - i] != 1){
                ans = X - i;
                break;
            }
//            if (X + i > 100){
//                continue;
//            }
            if (Pz[X + i] != 1){
                ans = X + i;
                break;
            }
        }
        System.out.println(ans);
    }
}