import java.util.*;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int X = Integer.parseInt(sc.next());
            int N = Integer.parseInt(sc.next());
            boolean[] p = new boolean[102];

            for (int i = 0; i < N; i++) {
                 p[Integer.parseInt(sc.next())] = true;
            }
            for (int i = 0; i <= 50; i++) {
                if (X - i >= 0 && !p[X - i]) {
                    System.out.println(X - i);
                    return;
                }
                if (X + i <= 101 && !p[X + i]) {
                    System.out.println(X + i);
                    return;
                }
            }
        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int X = Integer.parseInt(sc.next());
            int N = Integer.parseInt(sc.next());
            boolean[] p = new boolean[102];

            for (int i = 0; i < N; i++) {
                 p[Integer.parseInt(sc.next())] = true;
            }
            for (int i = 0; i <= 50; i++) {
                if (X - i >= 0 && !p[X - i]) {
                    System.out.println(X - i);
                    return;
                }
                if (X + i <= 101 && !p[X + i]) {
                    System.out.println(X + i);
                    return;
                }
            }
        }
    }
} Main public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int X = Integer.parseInt(sc.next());
            int N = Integer.parseInt(sc.next());
            boolean[] p = new boolean[102];

            for (int i = 0; i < N; i++) {
                 p[Integer.parseInt(sc.next())] = true;
            }
            for (int i = 0; i <= 50; i++) {
                if (X - i >= 0 && !p[X - i]) {
                    System.out.println(X - i);
                    return;
                }
                if (X + i <= 101 && !p[X + i]) {
                    System.out.println(X + i);
                    return;
                }
            }
        }
    } main {
        try (Scanner sc = new Scanner(System.in)) {
            int X = Integer.parseInt(sc.next());
            int N = Integer.parseInt(sc.next());
            boolean[] p = new boolean[102];

            for (int i = 0; i < N; i++) {
                 p[Integer.parseInt(sc.next())] = true;
            }
            for (int i = 0; i <= 50; i++) {
                if (X - i >= 0 && !p[X - i]) {
                    System.out.println(X - i);
                    return;
                }
                if (X + i <= 101 && !p[X + i]) {
                    System.out.println(X + i);
                    return;
                }
            }
        }
    } try (Scanner sc = new Scanner(System.in)) {
            int X = Integer.parseInt(sc.next());
            int N = Integer.parseInt(sc.next());
            boolean[] p = new boolean[102];

            for (int i = 0; i < N; i++) {
                 p[Integer.parseInt(sc.next())] = true;
            }
            for (int i = 0; i <= 50; i++) {
                if (X - i >= 0 && !p[X - i]) {
                    System.out.println(X - i);
                    return;
                }
                if (X + i <= 101 && !p[X + i]) {
                    System.out.println(X + i);
                    return;
                }
            }
        } {
            int X = Integer.parseInt(sc.next());
            int N = Integer.parseInt(sc.next());
            boolean[] p = new boolean[102];

            for (int i = 0; i < N; i++) {
                 p[Integer.parseInt(sc.next())] = true;
            }
            for (int i = 0; i <= 50; i++) {
                if (X - i >= 0 && !p[X - i]) {
                    System.out.println(X - i);
                    return;
                }
                if (X + i <= 101 && !p[X + i]) {
                    System.out.println(X + i);
                    return;
                }
            }
        } Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) int X = Integer.parseInt(sc.next()); X Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int N = Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc boolean[] p = new boolean[102]; p new boolean[102] 102 for (int i = 0; i < N; i++) {
                 p[Integer.parseInt(sc.next())] = true;
            } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
                 p[Integer.parseInt(sc.next())] = true;
            } {
                 p[Integer.parseInt(sc.next())] = true;
            } p[Integer.parseInt(sc.next())] = true p[Integer.parseInt(sc.next())] p Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc true for (int i = 0; i <= 50; i++) {
                if (X - i >= 0 && !p[X - i]) {
                    System.out.println(X - i);
                    return;
                }
                if (X + i <= 101 && !p[X + i]) {
                    System.out.println(X + i);
                    return;
                }
            } int i = 0; int i = 0; i 0 i <= 50 i 50 i++ i++ i {
                if (X - i >= 0 && !p[X - i]) {
                    System.out.println(X - i);
                    return;
                }
                if (X + i <= 101 && !p[X + i]) {
                    System.out.println(X + i);
                    return;
                }
            } {
                if (X - i >= 0 && !p[X - i]) {
                    System.out.println(X - i);
                    return;
                }
                if (X + i <= 101 && !p[X + i]) {
                    System.out.println(X + i);
                    return;
                }
            } if (X - i >= 0 && !p[X - i]) {
                    System.out.println(X - i);
                    return;
                } X - i >= 0 && !p[X - i] X - i >= 0 X - i X i 0 !p[X - i] p[X - i] p 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 (X + i <= 101 && !p[X + i]) {
                    System.out.println(X + i);
                    return;
                } X + i <= 101 && !p[X + i] X + i <= 101 X + i X i 101 !p[X + i] p[X + i] p 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) {
        try (Scanner sc = new Scanner(System.in)) {
            int X = Integer.parseInt(sc.next());
            int N = Integer.parseInt(sc.next());
            boolean[] p = new boolean[102];

            for (int i = 0; i < N; i++) {
                 p[Integer.parseInt(sc.next())] = true;
            }
            for (int i = 0; i <= 50; i++) {
                if (X - i >= 0 && !p[X - i]) {
                    System.out.println(X - i);
                    return;
                }
                if (X + i <= 101 && !p[X + i]) {
                    System.out.println(X + i);
                    return;
                }
            }
        }
    }
} public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int X = Integer.parseInt(sc.next());
            int N = Integer.parseInt(sc.next());
            boolean[] p = new boolean[102];

            for (int i = 0; i < N; i++) {
                 p[Integer.parseInt(sc.next())] = true;
            }
            for (int i = 0; i <= 50; i++) {
                if (X - i >= 0 && !p[X - i]) {
                    System.out.println(X - i);
                    return;
                }
                if (X + i <= 101 && !p[X + i]) {
                    System.out.println(X + i);
                    return;
                }
            }
        }
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int X = Integer.parseInt(sc.next());
            int N = Integer.parseInt(sc.next());
            boolean[] p = new boolean[102];

            for (int i = 0; i < N; i++) {
                 p[Integer.parseInt(sc.next())] = true;
            }
            for (int i = 0; i <= 50; i++) {
                if (X - i >= 0 && !p[X - i]) {
                    System.out.println(X - i);
                    return;
                }
                if (X + i <= 101 && !p[X + i]) {
                    System.out.println(X + i);
                    return;
                }
            }
        }
    }
}
