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 res = 0;
        if (N == 0) {
            res = X;
        } else {
            List<Integer> array = new ArrayList<>();
            for (int i = 0; i < N; i++) {
                array.add(sc.nextInt());
            }
            Map<Integer, Integer> absMap = new HashMap<>();
            for (int i = 0; i <= 105; i++) {
                int abs = Math.abs(X - i);
                absMap.put(i, abs);
            }

            int minVal = Integer.MAX_VALUE;
            for (int i : absMap.keySet()) {
                int val = absMap.get(i);
                if (val < minVal && !array.contains(i)) {
                    res = i;
                    minVal = val;
                }
            }
        }
        sc.close();
        System.out.println(res);

    }
} 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 res = 0;
        if (N == 0) {
            res = X;
        } else {
            List<Integer> array = new ArrayList<>();
            for (int i = 0; i < N; i++) {
                array.add(sc.nextInt());
            }
            Map<Integer, Integer> absMap = new HashMap<>();
            for (int i = 0; i <= 105; i++) {
                int abs = Math.abs(X - i);
                absMap.put(i, abs);
            }

            int minVal = Integer.MAX_VALUE;
            for (int i : absMap.keySet()) {
                int val = absMap.get(i);
                if (val < minVal && !array.contains(i)) {
                    res = i;
                    minVal = val;
                }
            }
        }
        sc.close();
        System.out.println(res);

    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
        int res = 0;
        if (N == 0) {
            res = X;
        } else {
            List<Integer> array = new ArrayList<>();
            for (int i = 0; i < N; i++) {
                array.add(sc.nextInt());
            }
            Map<Integer, Integer> absMap = new HashMap<>();
            for (int i = 0; i <= 105; i++) {
                int abs = Math.abs(X - i);
                absMap.put(i, abs);
            }

            int minVal = Integer.MAX_VALUE;
            for (int i : absMap.keySet()) {
                int val = absMap.get(i);
                if (val < minVal && !array.contains(i)) {
                    res = i;
                    minVal = val;
                }
            }
        }
        sc.close();
        System.out.println(res);

    } main {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
        int res = 0;
        if (N == 0) {
            res = X;
        } else {
            List<Integer> array = new ArrayList<>();
            for (int i = 0; i < N; i++) {
                array.add(sc.nextInt());
            }
            Map<Integer, Integer> absMap = new HashMap<>();
            for (int i = 0; i <= 105; i++) {
                int abs = Math.abs(X - i);
                absMap.put(i, abs);
            }

            int minVal = Integer.MAX_VALUE;
            for (int i : absMap.keySet()) {
                int val = absMap.get(i);
                if (val < minVal && !array.contains(i)) {
                    res = i;
                    minVal = val;
                }
            }
        }
        sc.close();
        System.out.println(res);

    } 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 res = 0; res 0 if (N == 0) {
            res = X;
        } else {
            List<Integer> array = new ArrayList<>();
            for (int i = 0; i < N; i++) {
                array.add(sc.nextInt());
            }
            Map<Integer, Integer> absMap = new HashMap<>();
            for (int i = 0; i <= 105; i++) {
                int abs = Math.abs(X - i);
                absMap.put(i, abs);
            }

            int minVal = Integer.MAX_VALUE;
            for (int i : absMap.keySet()) {
                int val = absMap.get(i);
                if (val < minVal && !array.contains(i)) {
                    res = i;
                    minVal = val;
                }
            }
        } N == 0 N 0 {
            res = X;
        } res = X res X {
            List<Integer> array = new ArrayList<>();
            for (int i = 0; i < N; i++) {
                array.add(sc.nextInt());
            }
            Map<Integer, Integer> absMap = new HashMap<>();
            for (int i = 0; i <= 105; i++) {
                int abs = Math.abs(X - i);
                absMap.put(i, abs);
            }

            int minVal = Integer.MAX_VALUE;
            for (int i : absMap.keySet()) {
                int val = absMap.get(i);
                if (val < minVal && !array.contains(i)) {
                    res = i;
                    minVal = val;
                }
            }
        } List<Integer> array = new ArrayList<>(); array new ArrayList<>() for (int i = 0; i < N; i++) {
                array.add(sc.nextInt());
            } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
                array.add(sc.nextInt());
            } {
                array.add(sc.nextInt());
            } array.add(sc.nextInt()) array.add array sc.nextInt() sc.nextInt sc Map<Integer, Integer> absMap = new HashMap<>(); absMap new HashMap<>() for (int i = 0; i <= 105; i++) {
                int abs = Math.abs(X - i);
                absMap.put(i, abs);
            } int i = 0; int i = 0; i 0 i <= 105 i 105 i++ i++ i {
                int abs = Math.abs(X - i);
                absMap.put(i, abs);
            } {
                int abs = Math.abs(X - i);
                absMap.put(i, abs);
            } int abs = Math.abs(X - i); abs Math.abs(X - i) Math.abs Math X - i X i absMap.put(i, abs) absMap.put absMap i abs int minVal = Integer.MAX_VALUE; minVal Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int i : absMap.keySet()) {
                int val = absMap.get(i);
                if (val < minVal && !array.contains(i)) {
                    res = i;
                    minVal = val;
                }
            } int i absMap.keySet() absMap.keySet absMap {
                int val = absMap.get(i);
                if (val < minVal && !array.contains(i)) {
                    res = i;
                    minVal = val;
                }
            } {
                int val = absMap.get(i);
                if (val < minVal && !array.contains(i)) {
                    res = i;
                    minVal = val;
                }
            } int val = absMap.get(i); val absMap.get(i) absMap.get absMap i if (val < minVal && !array.contains(i)) {
                    res = i;
                    minVal = val;
                } val < minVal && !array.contains(i) val < minVal val minVal !array.contains(i) array.contains(i) array.contains array i {
                    res = i;
                    minVal = val;
                } res = i res i minVal = val minVal val sc.close() sc.close sc System.out.println(res) System.out.println System.out System System.out res 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 res = 0;
        if (N == 0) {
            res = X;
        } else {
            List<Integer> array = new ArrayList<>();
            for (int i = 0; i < N; i++) {
                array.add(sc.nextInt());
            }
            Map<Integer, Integer> absMap = new HashMap<>();
            for (int i = 0; i <= 105; i++) {
                int abs = Math.abs(X - i);
                absMap.put(i, abs);
            }

            int minVal = Integer.MAX_VALUE;
            for (int i : absMap.keySet()) {
                int val = absMap.get(i);
                if (val < minVal && !array.contains(i)) {
                    res = i;
                    minVal = val;
                }
            }
        }
        sc.close();
        System.out.println(res);

    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
        int res = 0;
        if (N == 0) {
            res = X;
        } else {
            List<Integer> array = new ArrayList<>();
            for (int i = 0; i < N; i++) {
                array.add(sc.nextInt());
            }
            Map<Integer, Integer> absMap = new HashMap<>();
            for (int i = 0; i <= 105; i++) {
                int abs = Math.abs(X - i);
                absMap.put(i, abs);
            }

            int minVal = Integer.MAX_VALUE;
            for (int i : absMap.keySet()) {
                int val = absMap.get(i);
                if (val < minVal && !array.contains(i)) {
                    res = i;
                    minVal = val;
                }
            }
        }
        sc.close();
        System.out.println(res);

    }
} 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 res = 0;
        if (N == 0) {
            res = X;
        } else {
            List<Integer> array = new ArrayList<>();
            for (int i = 0; i < N; i++) {
                array.add(sc.nextInt());
            }
            Map<Integer, Integer> absMap = new HashMap<>();
            for (int i = 0; i <= 105; i++) {
                int abs = Math.abs(X - i);
                absMap.put(i, abs);
            }

            int minVal = Integer.MAX_VALUE;
            for (int i : absMap.keySet()) {
                int val = absMap.get(i);
                if (val < minVal && !array.contains(i)) {
                    res = i;
                    minVal = val;
                }
            }
        }
        sc.close();
        System.out.println(res);

    }
}
