import java.util.*;
import java.io.*;
import java.math.BigDecimal;
import java.nio.file.Files;
import java.nio.charset.StandardCharsets;
//给出两个数a,b 求出[a,b]中各位数字之和能整除原数的数的个数。
public class Main {

    int mod ;
    void solve(int v, int[] arr) {
        Set<Integer> set = new HashSet<>();
        int n = arr.length;
        for(int i=0;i<n;i++){
            set.add(arr[i]);
        }
        int add = 0;
        while(true){
            if(!set.contains(v-add)){
                System.out.println((v-add));
                return;
            }else if(!set.contains(v+add)){
                System.out.println((v+add));
                return;
            }
            add++;
        }

    }


    public static void main(String[] args)  throws IOException {
        // Use the Scanner class

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String[]  s = br.readLine().split(" ");
        Main test = new Main();

        int n = Integer.parseInt(s[0]);
        int len = Integer.parseInt(s[1]);
        int[] arr = new int[len];
        s = br.readLine().split(" ");
        for(int i=0;i<len;i++) {
           arr[i] = Integer.parseInt(s[i]);

        }

        test.solve(n, arr);
        //int tot = Integer.parseInt(br.readLine());


//        int i =1;
//        System.out.println();
//        while(tot>0){
//
//            String s = br.readLine();
//            String[] sr = s.split(" ");
//            List<Long> ls = new ArrayList<>();
//            for(String ss:sr){
//                ls.add(Long.parseLong(ss));
//            }
//            Main tt = new Main();
//            tt.sol(ls);
//            // String Buffer to store answer
//            StringBuffer sb = new StringBuffer();
////            Solution obj = new Solution();
////
////            System.out.println("Case #"+i+": "+obj.sol());
//            tot--;
//            i++;
//        }
    }

} import java.util.*; util.* java import java.io.*; io.* java import java.math.BigDecimal; BigDecimal java.math import java.nio.file.Files; Files java.nio.file import java.nio.charset.StandardCharsets; StandardCharsets java.nio.charset public class Main {

    int mod ;
    void solve(int v, int[] arr) {
        Set<Integer> set = new HashSet<>();
        int n = arr.length;
        for(int i=0;i<n;i++){
            set.add(arr[i]);
        }
        int add = 0;
        while(true){
            if(!set.contains(v-add)){
                System.out.println((v-add));
                return;
            }else if(!set.contains(v+add)){
                System.out.println((v+add));
                return;
            }
            add++;
        }

    }


    public static void main(String[] args)  throws IOException {
        // Use the Scanner class

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String[]  s = br.readLine().split(" ");
        Main test = new Main();

        int n = Integer.parseInt(s[0]);
        int len = Integer.parseInt(s[1]);
        int[] arr = new int[len];
        s = br.readLine().split(" ");
        for(int i=0;i<len;i++) {
           arr[i] = Integer.parseInt(s[i]);

        }

        test.solve(n, arr);
        //int tot = Integer.parseInt(br.readLine());


//        int i =1;
//        System.out.println();
//        while(tot>0){
//
//            String s = br.readLine();
//            String[] sr = s.split(" ");
//            List<Long> ls = new ArrayList<>();
//            for(String ss:sr){
//                ls.add(Long.parseLong(ss));
//            }
//            Main tt = new Main();
//            tt.sol(ls);
//            // String Buffer to store answer
//            StringBuffer sb = new StringBuffer();
////            Solution obj = new Solution();
////
////            System.out.println("Case #"+i+": "+obj.sol());
//            tot--;
//            i++;
//        }
    }

} Main int mod ; mod void solve(int v, int[] arr) {
        Set<Integer> set = new HashSet<>();
        int n = arr.length;
        for(int i=0;i<n;i++){
            set.add(arr[i]);
        }
        int add = 0;
        while(true){
            if(!set.contains(v-add)){
                System.out.println((v-add));
                return;
            }else if(!set.contains(v+add)){
                System.out.println((v+add));
                return;
            }
            add++;
        }

    } solve {
        Set<Integer> set = new HashSet<>();
        int n = arr.length;
        for(int i=0;i<n;i++){
            set.add(arr[i]);
        }
        int add = 0;
        while(true){
            if(!set.contains(v-add)){
                System.out.println((v-add));
                return;
            }else if(!set.contains(v+add)){
                System.out.println((v+add));
                return;
            }
            add++;
        }

    } Set<Integer> set = new HashSet<>(); set new HashSet<>() int n = arr.length; n arr.length arr arr.length for(int i=0;i<n;i++){
            set.add(arr[i]);
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            set.add(arr[i]);
        } {
            set.add(arr[i]);
        } set.add(arr[i]) set.add set arr[i] arr i int add = 0; add 0 while(true){
            if(!set.contains(v-add)){
                System.out.println((v-add));
                return;
            }else if(!set.contains(v+add)){
                System.out.println((v+add));
                return;
            }
            add++;
        } true {
            if(!set.contains(v-add)){
                System.out.println((v-add));
                return;
            }else if(!set.contains(v+add)){
                System.out.println((v+add));
                return;
            }
            add++;
        } if(!set.contains(v-add)){
                System.out.println((v-add));
                return;
            }else if(!set.contains(v+add)){
                System.out.println((v+add));
                return;
            } !set.contains(v-add) set.contains(v-add) set.contains set v-add v add {
                System.out.println((v-add));
                return;
            } System.out.println((v-add)) System.out.println System.out System System.out (v-add) v add return; if(!set.contains(v+add)){
                System.out.println((v+add));
                return;
            } !set.contains(v+add) set.contains(v+add) set.contains set v+add v add {
                System.out.println((v+add));
                return;
            } System.out.println((v+add)) System.out.println System.out System System.out (v+add) v add return; add++ add int v v int[] arr arr public static void main(String[] args)  throws IOException {
        // Use the Scanner class

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String[]  s = br.readLine().split(" ");
        Main test = new Main();

        int n = Integer.parseInt(s[0]);
        int len = Integer.parseInt(s[1]);
        int[] arr = new int[len];
        s = br.readLine().split(" ");
        for(int i=0;i<len;i++) {
           arr[i] = Integer.parseInt(s[i]);

        }

        test.solve(n, arr);
        //int tot = Integer.parseInt(br.readLine());


//        int i =1;
//        System.out.println();
//        while(tot>0){
//
//            String s = br.readLine();
//            String[] sr = s.split(" ");
//            List<Long> ls = new ArrayList<>();
//            for(String ss:sr){
//                ls.add(Long.parseLong(ss));
//            }
//            Main tt = new Main();
//            tt.sol(ls);
//            // String Buffer to store answer
//            StringBuffer sb = new StringBuffer();
////            Solution obj = new Solution();
////
////            System.out.println("Case #"+i+": "+obj.sol());
//            tot--;
//            i++;
//        }
    } main {
        // Use the Scanner class

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String[]  s = br.readLine().split(" ");
        Main test = new Main();

        int n = Integer.parseInt(s[0]);
        int len = Integer.parseInt(s[1]);
        int[] arr = new int[len];
        s = br.readLine().split(" ");
        for(int i=0;i<len;i++) {
           arr[i] = Integer.parseInt(s[i]);

        }

        test.solve(n, arr);
        //int tot = Integer.parseInt(br.readLine());


//        int i =1;
//        System.out.println();
//        while(tot>0){
//
//            String s = br.readLine();
//            String[] sr = s.split(" ");
//            List<Long> ls = new ArrayList<>();
//            for(String ss:sr){
//                ls.add(Long.parseLong(ss));
//            }
//            Main tt = new Main();
//            tt.sol(ls);
//            // String Buffer to store answer
//            StringBuffer sb = new StringBuffer();
////            Solution obj = new Solution();
////
////            System.out.println("Case #"+i+": "+obj.sol());
//            tot--;
//            i++;
//        }
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[]  s = br.readLine().split(" "); s br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " Main test = new Main(); test new Main() int n = Integer.parseInt(s[0]); n Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 int len = Integer.parseInt(s[1]); len Integer.parseInt(s[1]) Integer.parseInt Integer s[1] s 1 int[] arr = new int[len]; arr new int[len] len s = br.readLine().split(" ") s br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for(int i=0;i<len;i++) {
           arr[i] = Integer.parseInt(s[i]);

        } int i=0; int i=0; i 0 i<len i len i++ i++ i {
           arr[i] = Integer.parseInt(s[i]);

        } {
           arr[i] = Integer.parseInt(s[i]);

        } arr[i] = Integer.parseInt(s[i]) arr[i] arr i Integer.parseInt(s[i]) Integer.parseInt Integer s[i] s i test.solve(n, arr) test.solve test n arr String[] args args public class Main {

    int mod ;
    void solve(int v, int[] arr) {
        Set<Integer> set = new HashSet<>();
        int n = arr.length;
        for(int i=0;i<n;i++){
            set.add(arr[i]);
        }
        int add = 0;
        while(true){
            if(!set.contains(v-add)){
                System.out.println((v-add));
                return;
            }else if(!set.contains(v+add)){
                System.out.println((v+add));
                return;
            }
            add++;
        }

    }


    public static void main(String[] args)  throws IOException {
        // Use the Scanner class

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String[]  s = br.readLine().split(" ");
        Main test = new Main();

        int n = Integer.parseInt(s[0]);
        int len = Integer.parseInt(s[1]);
        int[] arr = new int[len];
        s = br.readLine().split(" ");
        for(int i=0;i<len;i++) {
           arr[i] = Integer.parseInt(s[i]);

        }

        test.solve(n, arr);
        //int tot = Integer.parseInt(br.readLine());


//        int i =1;
//        System.out.println();
//        while(tot>0){
//
//            String s = br.readLine();
//            String[] sr = s.split(" ");
//            List<Long> ls = new ArrayList<>();
//            for(String ss:sr){
//                ls.add(Long.parseLong(ss));
//            }
//            Main tt = new Main();
//            tt.sol(ls);
//            // String Buffer to store answer
//            StringBuffer sb = new StringBuffer();
////            Solution obj = new Solution();
////
////            System.out.println("Case #"+i+": "+obj.sol());
//            tot--;
//            i++;
//        }
    }

} public class Main {

    int mod ;
    void solve(int v, int[] arr) {
        Set<Integer> set = new HashSet<>();
        int n = arr.length;
        for(int i=0;i<n;i++){
            set.add(arr[i]);
        }
        int add = 0;
        while(true){
            if(!set.contains(v-add)){
                System.out.println((v-add));
                return;
            }else if(!set.contains(v+add)){
                System.out.println((v+add));
                return;
            }
            add++;
        }

    }


    public static void main(String[] args)  throws IOException {
        // Use the Scanner class

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String[]  s = br.readLine().split(" ");
        Main test = new Main();

        int n = Integer.parseInt(s[0]);
        int len = Integer.parseInt(s[1]);
        int[] arr = new int[len];
        s = br.readLine().split(" ");
        for(int i=0;i<len;i++) {
           arr[i] = Integer.parseInt(s[i]);

        }

        test.solve(n, arr);
        //int tot = Integer.parseInt(br.readLine());


//        int i =1;
//        System.out.println();
//        while(tot>0){
//
//            String s = br.readLine();
//            String[] sr = s.split(" ");
//            List<Long> ls = new ArrayList<>();
//            for(String ss:sr){
//                ls.add(Long.parseLong(ss));
//            }
//            Main tt = new Main();
//            tt.sol(ls);
//            // String Buffer to store answer
//            StringBuffer sb = new StringBuffer();
////            Solution obj = new Solution();
////
////            System.out.println("Case #"+i+": "+obj.sol());
//            tot--;
//            i++;
//        }
    }

} Main
import java.util.*;
import java.io.*;
import java.math.BigDecimal;
import java.nio.file.Files;
import java.nio.charset.StandardCharsets;
//给出两个数a,b 求出[a,b]中各位数字之和能整除原数的数的个数。
public class Main {

    int mod ;
    void solve(int v, int[] arr) {
        Set<Integer> set = new HashSet<>();
        int n = arr.length;
        for(int i=0;i<n;i++){
            set.add(arr[i]);
        }
        int add = 0;
        while(true){
            if(!set.contains(v-add)){
                System.out.println((v-add));
                return;
            }else if(!set.contains(v+add)){
                System.out.println((v+add));
                return;
            }
            add++;
        }

    }


    public static void main(String[] args)  throws IOException {
        // Use the Scanner class

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String[]  s = br.readLine().split(" ");
        Main test = new Main();

        int n = Integer.parseInt(s[0]);
        int len = Integer.parseInt(s[1]);
        int[] arr = new int[len];
        s = br.readLine().split(" ");
        for(int i=0;i<len;i++) {
           arr[i] = Integer.parseInt(s[i]);

        }

        test.solve(n, arr);
        //int tot = Integer.parseInt(br.readLine());


//        int i =1;
//        System.out.println();
//        while(tot>0){
//
//            String s = br.readLine();
//            String[] sr = s.split(" ");
//            List<Long> ls = new ArrayList<>();
//            for(String ss:sr){
//                ls.add(Long.parseLong(ss));
//            }
//            Main tt = new Main();
//            tt.sol(ls);
//            // String Buffer to store answer
//            StringBuffer sb = new StringBuffer();
////            Solution obj = new Solution();
////
////            System.out.println("Case #"+i+": "+obj.sol());
//            tot--;
//            i++;
//        }
    }

}
