import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        int[] p = new int[n];
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < n; i++) {
            p[i] = sc.nextInt();
            set.add(p[i]);
        }
        if (n == 0) {
            System.out.println(x);
            return;
        }
        for (int i = 0; i <= 100; i++) {
            if (!set.contains(x - i)) {
                System.out.println(x - i);
                return;
            }
            if (!set.contains(x + i)) {
                System.out.println(x + i);
                return;
            }
        }
    }

} import java.util.HashSet; HashSet java.util import java.util.Scanner; Scanner java.util import java.util.Set; Set 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[] p = new int[n];
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < n; i++) {
            p[i] = sc.nextInt();
            set.add(p[i]);
        }
        if (n == 0) {
            System.out.println(x);
            return;
        }
        for (int i = 0; i <= 100; i++) {
            if (!set.contains(x - i)) {
                System.out.println(x - i);
                return;
            }
            if (!set.contains(x + i)) {
                System.out.println(x + i);
                return;
            }
        }
    }

} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        int[] p = new int[n];
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < n; i++) {
            p[i] = sc.nextInt();
            set.add(p[i]);
        }
        if (n == 0) {
            System.out.println(x);
            return;
        }
        for (int i = 0; i <= 100; i++) {
            if (!set.contains(x - i)) {
                System.out.println(x - i);
                return;
            }
            if (!set.contains(x + i)) {
                System.out.println(x + i);
                return;
            }
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        int[] p = new int[n];
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < n; i++) {
            p[i] = sc.nextInt();
            set.add(p[i]);
        }
        if (n == 0) {
            System.out.println(x);
            return;
        }
        for (int i = 0; i <= 100; i++) {
            if (!set.contains(x - i)) {
                System.out.println(x - i);
                return;
            }
            if (!set.contains(x + i)) {
                System.out.println(x + i);
                return;
            }
        }
    } 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[] p = new int[n]; p new int[n] n Set<Integer> set = new HashSet<>(); set new HashSet<>() for (int i = 0; i < n; i++) {
            p[i] = sc.nextInt();
            set.add(p[i]);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            p[i] = sc.nextInt();
            set.add(p[i]);
        } {
            p[i] = sc.nextInt();
            set.add(p[i]);
        } p[i] = sc.nextInt() p[i] p i sc.nextInt() sc.nextInt sc set.add(p[i]) set.add set p[i] p i if (n == 0) {
            System.out.println(x);
            return;
        } n == 0 n 0 {
            System.out.println(x);
            return;
        } System.out.println(x) System.out.println System.out System System.out x return; for (int i = 0; i <= 100; i++) {
            if (!set.contains(x - i)) {
                System.out.println(x - i);
                return;
            }
            if (!set.contains(x + i)) {
                System.out.println(x + i);
                return;
            }
        } int i = 0; int i = 0; i 0 i <= 100 i 100 i++ i++ i {
            if (!set.contains(x - i)) {
                System.out.println(x - i);
                return;
            }
            if (!set.contains(x + i)) {
                System.out.println(x + i);
                return;
            }
        } {
            if (!set.contains(x - i)) {
                System.out.println(x - i);
                return;
            }
            if (!set.contains(x + i)) {
                System.out.println(x + i);
                return;
            }
        } if (!set.contains(x - i)) {
                System.out.println(x - i);
                return;
            } !set.contains(x - i) set.contains(x - i) set.contains set x - i x i {
                System.out.println(x - i);
                return;
            } System.out.println(x - i) System.out.println System.out System System.out x - i x i return; if (!set.contains(x + i)) {
                System.out.println(x + i);
                return;
            } !set.contains(x + i) set.contains(x + i) set.contains set x + i x i {
                System.out.println(x + i);
                return;
            } System.out.println(x + i) System.out.println System.out System System.out x + i x i return; 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[] p = new int[n];
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < n; i++) {
            p[i] = sc.nextInt();
            set.add(p[i]);
        }
        if (n == 0) {
            System.out.println(x);
            return;
        }
        for (int i = 0; i <= 100; i++) {
            if (!set.contains(x - i)) {
                System.out.println(x - i);
                return;
            }
            if (!set.contains(x + i)) {
                System.out.println(x + i);
                return;
            }
        }
    }

} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        int[] p = new int[n];
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < n; i++) {
            p[i] = sc.nextInt();
            set.add(p[i]);
        }
        if (n == 0) {
            System.out.println(x);
            return;
        }
        for (int i = 0; i <= 100; i++) {
            if (!set.contains(x - i)) {
                System.out.println(x - i);
                return;
            }
            if (!set.contains(x + i)) {
                System.out.println(x + i);
                return;
            }
        }
    }

} Main
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        int[] p = new int[n];
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < n; i++) {
            p[i] = sc.nextInt();
            set.add(p[i]);
        }
        if (n == 0) {
            System.out.println(x);
            return;
        }
        for (int i = 0; i <= 100; i++) {
            if (!set.contains(x - i)) {
                System.out.println(x - i);
                return;
            }
            if (!set.contains(x + i)) {
                System.out.println(x + i);
                return;
            }
        }
    }

}
