import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

public class Main {
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new java.io.InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        StringTokenizer st = new StringTokenizer(br.readLine());

        int X = Integer.parseInt(st.nextToken());
        int N = Integer.parseInt(st.nextToken());

        if(N == 0) {
            pw.println(X);
            br.close();
            pw.close();
            return;
        }

        String[] input_array = br.readLine().split(" ");

        Set<Integer> checkSet = new HashSet<>();

        for(String str : input_array) {
            checkSet.add(Integer.parseInt(str));
        }

        int up = X;
        int down = X;
        int increment = 1;

        if(!checkSet.contains(X)) {
            pw.println(X);
            br.close();
            pw.close();
            return;
        }

        while(up != 100 || down != 0) {
            up += increment;
            down -= increment;

            if(!checkSet.contains(down)) {
                pw.println(down);
                break;
            } else if(!checkSet.contains(up)) {
                pw.println(up);
                break;
            }
        } 

        br.close();
        pw.close();
    }
}
/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