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);

    }
}

/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz