import java.util.*;

public class Main {
    public static void main(String[] args) {
      Scanner s = new Scanner(System.in);
        String X = s.next();
        final int N = s.nextInt();
        List<String> pList = new ArrayList<String>();

        for (int i = 0 ; i < N ; i++) {
            pList.add(s.next());
        }

        if (pList.size() == 0 || !pList.contains(X)) {
            System.out.println(X);
            return;
        }

        int idx = 1;
        while (true) {
            String minus = String.valueOf(Integer.parseInt(X) - idx);
            String plus = String.valueOf(Integer.parseInt(X) + idx);
          
          if (pList.contains(minus) && pList.contains(plus)) {
                idx++;
                continue;
            }

            if (!pList.contains(minus) && !pList.contains(plus)) {
                System.out.println(minus);
                break;
            } else if (!pList.contains(minus)) {
                System.out.println(minus);
                break;
            } else {
                System.out.println(plus);
                break;
            }
        }
    }
}
/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