//package atcoder;

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

public class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(System.in);
        final int X = in.nextInt();
        final int N = in.nextInt();
        final Set<Integer> p = new HashSet<>();

        for (int i = 1; i <= N; ++i) {
            p.add(in.nextInt());
        }

        for (int d = 0; d <= 100; ++d){
            if (!p.contains(X - d)) {
                System.out.println(X - d);
                return;
            }
            if (!p.contains(X + d)) {
                System.out.println(X + d);
                return;
            }
        }
        System.out.println(0);
    }
} 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) {
        final Scanner in = new Scanner(System.in);
        final int X = in.nextInt();
        final int N = in.nextInt();
        final Set<Integer> p = new HashSet<>();

        for (int i = 1; i <= N; ++i) {
            p.add(in.nextInt());
        }

        for (int d = 0; d <= 100; ++d){
            if (!p.contains(X - d)) {
                System.out.println(X - d);
                return;
            }
            if (!p.contains(X + d)) {
                System.out.println(X + d);
                return;
            }
        }
        System.out.println(0);
    }
} Main public static void main(String[] args) {
        final Scanner in = new Scanner(System.in);
        final int X = in.nextInt();
        final int N = in.nextInt();
        final Set<Integer> p = new HashSet<>();

        for (int i = 1; i <= N; ++i) {
            p.add(in.nextInt());
        }

        for (int d = 0; d <= 100; ++d){
            if (!p.contains(X - d)) {
                System.out.println(X - d);
                return;
            }
            if (!p.contains(X + d)) {
                System.out.println(X + d);
                return;
            }
        }
        System.out.println(0);
    } main {
        final Scanner in = new Scanner(System.in);
        final int X = in.nextInt();
        final int N = in.nextInt();
        final Set<Integer> p = new HashSet<>();

        for (int i = 1; i <= N; ++i) {
            p.add(in.nextInt());
        }

        for (int d = 0; d <= 100; ++d){
            if (!p.contains(X - d)) {
                System.out.println(X - d);
                return;
            }
            if (!p.contains(X + d)) {
                System.out.println(X + d);
                return;
            }
        }
        System.out.println(0);
    } final Scanner in = new Scanner(System.in); in new Scanner(System.in) final int X = in.nextInt(); X in.nextInt() in.nextInt in final int N = in.nextInt(); N in.nextInt() in.nextInt in final Set<Integer> p = new HashSet<>(); p new HashSet<>() for (int i = 1; i <= N; ++i) {
            p.add(in.nextInt());
        } int i = 1; int i = 1; i 1 i <= N i N ++i ++i i {
            p.add(in.nextInt());
        } {
            p.add(in.nextInt());
        } p.add(in.nextInt()) p.add p in.nextInt() in.nextInt in for (int d = 0; d <= 100; ++d){
            if (!p.contains(X - d)) {
                System.out.println(X - d);
                return;
            }
            if (!p.contains(X + d)) {
                System.out.println(X + d);
                return;
            }
        } int d = 0; int d = 0; d 0 d <= 100 d 100 ++d ++d d {
            if (!p.contains(X - d)) {
                System.out.println(X - d);
                return;
            }
            if (!p.contains(X + d)) {
                System.out.println(X + d);
                return;
            }
        } {
            if (!p.contains(X - d)) {
                System.out.println(X - d);
                return;
            }
            if (!p.contains(X + d)) {
                System.out.println(X + d);
                return;
            }
        } if (!p.contains(X - d)) {
                System.out.println(X - d);
                return;
            } !p.contains(X - d) p.contains(X - d) p.contains p X - d X d {
                System.out.println(X - d);
                return;
            } System.out.println(X - d) System.out.println System.out System System.out X - d X d return; if (!p.contains(X + d)) {
                System.out.println(X + d);
                return;
            } !p.contains(X + d) p.contains(X + d) p.contains p X + d X d {
                System.out.println(X + d);
                return;
            } System.out.println(X + d) System.out.println System.out System System.out X + d X d return; System.out.println(0) System.out.println System.out System System.out 0 String[] args args public class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(System.in);
        final int X = in.nextInt();
        final int N = in.nextInt();
        final Set<Integer> p = new HashSet<>();

        for (int i = 1; i <= N; ++i) {
            p.add(in.nextInt());
        }

        for (int d = 0; d <= 100; ++d){
            if (!p.contains(X - d)) {
                System.out.println(X - d);
                return;
            }
            if (!p.contains(X + d)) {
                System.out.println(X + d);
                return;
            }
        }
        System.out.println(0);
    }
} public class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(System.in);
        final int X = in.nextInt();
        final int N = in.nextInt();
        final Set<Integer> p = new HashSet<>();

        for (int i = 1; i <= N; ++i) {
            p.add(in.nextInt());
        }

        for (int d = 0; d <= 100; ++d){
            if (!p.contains(X - d)) {
                System.out.println(X - d);
                return;
            }
            if (!p.contains(X + d)) {
                System.out.println(X + d);
                return;
            }
        }
        System.out.println(0);
    }
} Main
//package atcoder;

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

public class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(System.in);
        final int X = in.nextInt();
        final int N = in.nextInt();
        final Set<Integer> p = new HashSet<>();

        for (int i = 1; i <= N; ++i) {
            p.add(in.nextInt());
        }

        for (int d = 0; d <= 100; ++d){
            if (!p.contains(X - d)) {
                System.out.println(X - d);
                return;
            }
            if (!p.contains(X + d)) {
                System.out.println(X + d);
                return;
            }
        }
        System.out.println(0);
    }
}
