import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main{
    static MyReader in = new MyReader();

    public static void main(String[] args){
        int X = in.i();
        int N = in.i();
        int[] p = in.ii(N);

        boolean[] b = new boolean[102];
        for (int i = 0; i < N; i++) {
            b[p[i]] = true;
        }

        int ans = X;
        if (b[X]) {
            ans = 0;
            for (int i = X - 1; i > 0; i--) {
                if (!b[i]) {
                    ans = i;
                    break;
                }
            }
            for (int i = X + 1; i < 102; i++) {
                if (!b[i]) {
                    if (i - X < X - ans) {
                        ans = i;
                    }
                    break;
                }
            }
        }
        out.println(ans);
    }

    static class MyReader extends BufferedReader {
        char[] cbuf = new char[1024];
        int head = 0;
        int tail = 0;

        MyReader() {
            super(new InputStreamReader(System.in));
        }

        char next() {
            if (head == tail) {
                try {
                    tail = read(cbuf, 0, cbuf.length);
                } catch (IOException e) {}
                head = 0;
            }
            return cbuf[head++];
        }

        void back() {
            head--;
        }

        boolean minus() {
            boolean minus;
            while (true) {
                char c = next();
                if (c != ' ' && c != '\n' && c != '\r') {
                    if (!(minus = c == '-')) back();
                    return minus;
                }
            }
        }

        void skip() {
            while (true) {
                char c = next();
                if (c != ' ' && c != '\n' && c != '\r') {
                    back();
                    break;
                }
            }
        }

        char[] s(final int N) {
            skip();
            char[] s = new char[N];
            for (int i = 0; i < s.length; i++) {
                s[i] = next();
            }
            return s;
        }

        int i() {
            boolean minus = minus();
            int n = 0;
            while (true) {
                int k = next() - '0';
                if (k < 0 || 9 < k) break;
                n = 10 * n + k;
            }
            return minus ? -n : n;
        }

        int[] ii(final int N) {
            int[] a = new int[N];
            for (int j = 0; j < a.length; j++) a[j] = i();
            return a;
        }

        long l() {
            boolean minus = minus();
            long n = 0;
            while (true) {
                int k = next() - '0';
                if (k < 0 || 9 < k) break;
                n = 10 * n + k;
            }
            return minus ? -n : n;
        }
    }
} import java.io.*; io.* java import java.util.*; util.* java import static java.lang.System.out; import static java.lang.System.out; import static java.lang.System.out; public class Main{
    static MyReader in = new MyReader();

    public static void main(String[] args){
        int X = in.i();
        int N = in.i();
        int[] p = in.ii(N);

        boolean[] b = new boolean[102];
        for (int i = 0; i < N; i++) {
            b[p[i]] = true;
        }

        int ans = X;
        if (b[X]) {
            ans = 0;
            for (int i = X - 1; i > 0; i--) {
                if (!b[i]) {
                    ans = i;
                    break;
                }
            }
            for (int i = X + 1; i < 102; i++) {
                if (!b[i]) {
                    if (i - X < X - ans) {
                        ans = i;
                    }
                    break;
                }
            }
        }
        out.println(ans);
    }

    static class MyReader extends BufferedReader {
        char[] cbuf = new char[1024];
        int head = 0;
        int tail = 0;

        MyReader() {
            super(new InputStreamReader(System.in));
        }

        char next() {
            if (head == tail) {
                try {
                    tail = read(cbuf, 0, cbuf.length);
                } catch (IOException e) {}
                head = 0;
            }
            return cbuf[head++];
        }

        void back() {
            head--;
        }

        boolean minus() {
            boolean minus;
            while (true) {
                char c = next();
                if (c != ' ' && c != '\n' && c != '\r') {
                    if (!(minus = c == '-')) back();
                    return minus;
                }
            }
        }

        void skip() {
            while (true) {
                char c = next();
                if (c != ' ' && c != '\n' && c != '\r') {
                    back();
                    break;
                }
            }
        }

        char[] s(final int N) {
            skip();
            char[] s = new char[N];
            for (int i = 0; i < s.length; i++) {
                s[i] = next();
            }
            return s;
        }

        int i() {
            boolean minus = minus();
            int n = 0;
            while (true) {
                int k = next() - '0';
                if (k < 0 || 9 < k) break;
                n = 10 * n + k;
            }
            return minus ? -n : n;
        }

        int[] ii(final int N) {
            int[] a = new int[N];
            for (int j = 0; j < a.length; j++) a[j] = i();
            return a;
        }

        long l() {
            boolean minus = minus();
            long n = 0;
            while (true) {
                int k = next() - '0';
                if (k < 0 || 9 < k) break;
                n = 10 * n + k;
            }
            return minus ? -n : n;
        }
    }
} Main static MyReader in = new MyReader(); in new MyReader() public static void main(String[] args){
        int X = in.i();
        int N = in.i();
        int[] p = in.ii(N);

        boolean[] b = new boolean[102];
        for (int i = 0; i < N; i++) {
            b[p[i]] = true;
        }

        int ans = X;
        if (b[X]) {
            ans = 0;
            for (int i = X - 1; i > 0; i--) {
                if (!b[i]) {
                    ans = i;
                    break;
                }
            }
            for (int i = X + 1; i < 102; i++) {
                if (!b[i]) {
                    if (i - X < X - ans) {
                        ans = i;
                    }
                    break;
                }
            }
        }
        out.println(ans);
    } main {
        int X = in.i();
        int N = in.i();
        int[] p = in.ii(N);

        boolean[] b = new boolean[102];
        for (int i = 0; i < N; i++) {
            b[p[i]] = true;
        }

        int ans = X;
        if (b[X]) {
            ans = 0;
            for (int i = X - 1; i > 0; i--) {
                if (!b[i]) {
                    ans = i;
                    break;
                }
            }
            for (int i = X + 1; i < 102; i++) {
                if (!b[i]) {
                    if (i - X < X - ans) {
                        ans = i;
                    }
                    break;
                }
            }
        }
        out.println(ans);
    } int X = in.i(); X in.i() in.i in int N = in.i(); N in.i() in.i in int[] p = in.ii(N); p in.ii(N) in.ii in N boolean[] b = new boolean[102]; b new boolean[102] 102 for (int i = 0; i < N; i++) {
            b[p[i]] = true;
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            b[p[i]] = true;
        } {
            b[p[i]] = true;
        } b[p[i]] = true b[p[i]] b p[i] p i true int ans = X; ans X if (b[X]) {
            ans = 0;
            for (int i = X - 1; i > 0; i--) {
                if (!b[i]) {
                    ans = i;
                    break;
                }
            }
            for (int i = X + 1; i < 102; i++) {
                if (!b[i]) {
                    if (i - X < X - ans) {
                        ans = i;
                    }
                    break;
                }
            }
        } b[X] b X {
            ans = 0;
            for (int i = X - 1; i > 0; i--) {
                if (!b[i]) {
                    ans = i;
                    break;
                }
            }
            for (int i = X + 1; i < 102; i++) {
                if (!b[i]) {
                    if (i - X < X - ans) {
                        ans = i;
                    }
                    break;
                }
            }
        } ans = 0 ans 0 for (int i = X - 1; i > 0; i--) {
                if (!b[i]) {
                    ans = i;
                    break;
                }
            } int i = X - 1; int i = X - 1; i X - 1 X 1 i > 0 i 0 i-- i-- i {
                if (!b[i]) {
                    ans = i;
                    break;
                }
            } {
                if (!b[i]) {
                    ans = i;
                    break;
                }
            } if (!b[i]) {
                    ans = i;
                    break;
                } !b[i] b[i] b i {
                    ans = i;
                    break;
                } ans = i ans i break; for (int i = X + 1; i < 102; i++) {
                if (!b[i]) {
                    if (i - X < X - ans) {
                        ans = i;
                    }
                    break;
                }
            } int i = X + 1; int i = X + 1; i X + 1 X 1 i < 102 i 102 i++ i++ i {
                if (!b[i]) {
                    if (i - X < X - ans) {
                        ans = i;
                    }
                    break;
                }
            } {
                if (!b[i]) {
                    if (i - X < X - ans) {
                        ans = i;
                    }
                    break;
                }
            } if (!b[i]) {
                    if (i - X < X - ans) {
                        ans = i;
                    }
                    break;
                } !b[i] b[i] b i {
                    if (i - X < X - ans) {
                        ans = i;
                    }
                    break;
                } if (i - X < X - ans) {
                        ans = i;
                    } i - X < X - ans i - X i X X - ans X ans {
                        ans = i;
                    } ans = i ans i break; out.println(ans) out.println out ans String[] args args static class MyReader extends BufferedReader {
        char[] cbuf = new char[1024];
        int head = 0;
        int tail = 0;

        MyReader() {
            super(new InputStreamReader(System.in));
        }

        char next() {
            if (head == tail) {
                try {
                    tail = read(cbuf, 0, cbuf.length);
                } catch (IOException e) {}
                head = 0;
            }
            return cbuf[head++];
        }

        void back() {
            head--;
        }

        boolean minus() {
            boolean minus;
            while (true) {
                char c = next();
                if (c != ' ' && c != '\n' && c != '\r') {
                    if (!(minus = c == '-')) back();
                    return minus;
                }
            }
        }

        void skip() {
            while (true) {
                char c = next();
                if (c != ' ' && c != '\n' && c != '\r') {
                    back();
                    break;
                }
            }
        }

        char[] s(final int N) {
            skip();
            char[] s = new char[N];
            for (int i = 0; i < s.length; i++) {
                s[i] = next();
            }
            return s;
        }

        int i() {
            boolean minus = minus();
            int n = 0;
            while (true) {
                int k = next() - '0';
                if (k < 0 || 9 < k) break;
                n = 10 * n + k;
            }
            return minus ? -n : n;
        }

        int[] ii(final int N) {
            int[] a = new int[N];
            for (int j = 0; j < a.length; j++) a[j] = i();
            return a;
        }

        long l() {
            boolean minus = minus();
            long n = 0;
            while (true) {
                int k = next() - '0';
                if (k < 0 || 9 < k) break;
                n = 10 * n + k;
            }
            return minus ? -n : n;
        }
    } MyReader char[] cbuf = new char[1024]; cbuf new char[1024] 1024 int head = 0; head 0 int tail = 0; tail 0 MyReader() {
            super(new InputStreamReader(System.in));
        } MyReader {
            super(new InputStreamReader(System.in));
        } super(new InputStreamReader(System.in)) super new InputStreamReader(System.in) char next() {
            if (head == tail) {
                try {
                    tail = read(cbuf, 0, cbuf.length);
                } catch (IOException e) {}
                head = 0;
            }
            return cbuf[head++];
        } next {
            if (head == tail) {
                try {
                    tail = read(cbuf, 0, cbuf.length);
                } catch (IOException e) {}
                head = 0;
            }
            return cbuf[head++];
        } if (head == tail) {
                try {
                    tail = read(cbuf, 0, cbuf.length);
                } catch (IOException e) {}
                head = 0;
            } head == tail head tail {
                try {
                    tail = read(cbuf, 0, cbuf.length);
                } catch (IOException e) {}
                head = 0;
            } try {
                    tail = read(cbuf, 0, cbuf.length);
                } catch (IOException e) {} catch (IOException e) {} IOException e {} {
                    tail = read(cbuf, 0, cbuf.length);
                } tail = read(cbuf, 0, cbuf.length) tail read(cbuf, 0, cbuf.length) read cbuf 0 cbuf.length cbuf cbuf.length head = 0 head 0 return cbuf[head++]; cbuf[head++] cbuf head++ head void back() {
            head--;
        } back {
            head--;
        } head-- head boolean minus() {
            boolean minus;
            while (true) {
                char c = next();
                if (c != ' ' && c != '\n' && c != '\r') {
                    if (!(minus = c == '-')) back();
                    return minus;
                }
            }
        } minus {
            boolean minus;
            while (true) {
                char c = next();
                if (c != ' ' && c != '\n' && c != '\r') {
                    if (!(minus = c == '-')) back();
                    return minus;
                }
            }
        } boolean minus; minus while (true) {
                char c = next();
                if (c != ' ' && c != '\n' && c != '\r') {
                    if (!(minus = c == '-')) back();
                    return minus;
                }
            } true {
                char c = next();
                if (c != ' ' && c != '\n' && c != '\r') {
                    if (!(minus = c == '-')) back();
                    return minus;
                }
            } char c = next(); c next() next if (c != ' ' && c != '\n' && c != '\r') {
                    if (!(minus = c == '-')) back();
                    return minus;
                } c != ' ' && c != '\n' && c != '\r' c != ' ' && c != '\n' && c != '\r' c != ' ' c ' ' c != '\n' c '\n' c != '\r' c '\r' {
                    if (!(minus = c == '-')) back();
                    return minus;
                } if (!(minus = c == '-')) back(); !(minus = c == '-') (minus = c == '-') minus c == '-' c '-' back() back return minus; minus void skip() {
            while (true) {
                char c = next();
                if (c != ' ' && c != '\n' && c != '\r') {
                    back();
                    break;
                }
            }
        } skip {
            while (true) {
                char c = next();
                if (c != ' ' && c != '\n' && c != '\r') {
                    back();
                    break;
                }
            }
        } while (true) {
                char c = next();
                if (c != ' ' && c != '\n' && c != '\r') {
                    back();
                    break;
                }
            } true {
                char c = next();
                if (c != ' ' && c != '\n' && c != '\r') {
                    back();
                    break;
                }
            } char c = next(); c next() next if (c != ' ' && c != '\n' && c != '\r') {
                    back();
                    break;
                } c != ' ' && c != '\n' && c != '\r' c != ' ' && c != '\n' && c != '\r' c != ' ' c ' ' c != '\n' c '\n' c != '\r' c '\r' {
                    back();
                    break;
                } back() back break; char[] s(final int N) {
            skip();
            char[] s = new char[N];
            for (int i = 0; i < s.length; i++) {
                s[i] = next();
            }
            return s;
        } s {
            skip();
            char[] s = new char[N];
            for (int i = 0; i < s.length; i++) {
                s[i] = next();
            }
            return s;
        } skip() skip char[] s = new char[N]; s new char[N] N for (int i = 0; i < s.length; i++) {
                s[i] = next();
            } int i = 0; int i = 0; i 0 i < s.length i s.length s s.length i++ i++ i {
                s[i] = next();
            } {
                s[i] = next();
            } s[i] = next() s[i] s i next() next return s; s final int N N int i() {
            boolean minus = minus();
            int n = 0;
            while (true) {
                int k = next() - '0';
                if (k < 0 || 9 < k) break;
                n = 10 * n + k;
            }
            return minus ? -n : n;
        } i {
            boolean minus = minus();
            int n = 0;
            while (true) {
                int k = next() - '0';
                if (k < 0 || 9 < k) break;
                n = 10 * n + k;
            }
            return minus ? -n : n;
        } boolean minus = minus(); minus minus() minus int n = 0; n 0 while (true) {
                int k = next() - '0';
                if (k < 0 || 9 < k) break;
                n = 10 * n + k;
            } true {
                int k = next() - '0';
                if (k < 0 || 9 < k) break;
                n = 10 * n + k;
            } int k = next() - '0'; k next() - '0' next() next '0' if (k < 0 || 9 < k) break; k < 0 || 9 < k k < 0 k 0 9 < k 9 k break; n = 10 * n + k n 10 * n + k 10 * n 10 n k return minus ? -n : n; minus ? -n : n minus -n n n int[] ii(final int N) {
            int[] a = new int[N];
            for (int j = 0; j < a.length; j++) a[j] = i();
            return a;
        } ii {
            int[] a = new int[N];
            for (int j = 0; j < a.length; j++) a[j] = i();
            return a;
        } int[] a = new int[N]; a new int[N] N for (int j = 0; j < a.length; j++) a[j] = i(); int j = 0; int j = 0; j 0 j < a.length j a.length a a.length j++ j++ j a[j] = i(); a[j] = i() a[j] a j i() i return a; a final int N N long l() {
            boolean minus = minus();
            long n = 0;
            while (true) {
                int k = next() - '0';
                if (k < 0 || 9 < k) break;
                n = 10 * n + k;
            }
            return minus ? -n : n;
        } l {
            boolean minus = minus();
            long n = 0;
            while (true) {
                int k = next() - '0';
                if (k < 0 || 9 < k) break;
                n = 10 * n + k;
            }
            return minus ? -n : n;
        } boolean minus = minus(); minus minus() minus long n = 0; n 0 while (true) {
                int k = next() - '0';
                if (k < 0 || 9 < k) break;
                n = 10 * n + k;
            } true {
                int k = next() - '0';
                if (k < 0 || 9 < k) break;
                n = 10 * n + k;
            } int k = next() - '0'; k next() - '0' next() next '0' if (k < 0 || 9 < k) break; k < 0 || 9 < k k < 0 k 0 9 < k 9 k break; n = 10 * n + k n 10 * n + k 10 * n 10 n k return minus ? -n : n; minus ? -n : n minus -n n n BufferedReader public class Main{
    static MyReader in = new MyReader();

    public static void main(String[] args){
        int X = in.i();
        int N = in.i();
        int[] p = in.ii(N);

        boolean[] b = new boolean[102];
        for (int i = 0; i < N; i++) {
            b[p[i]] = true;
        }

        int ans = X;
        if (b[X]) {
            ans = 0;
            for (int i = X - 1; i > 0; i--) {
                if (!b[i]) {
                    ans = i;
                    break;
                }
            }
            for (int i = X + 1; i < 102; i++) {
                if (!b[i]) {
                    if (i - X < X - ans) {
                        ans = i;
                    }
                    break;
                }
            }
        }
        out.println(ans);
    }

    static class MyReader extends BufferedReader {
        char[] cbuf = new char[1024];
        int head = 0;
        int tail = 0;

        MyReader() {
            super(new InputStreamReader(System.in));
        }

        char next() {
            if (head == tail) {
                try {
                    tail = read(cbuf, 0, cbuf.length);
                } catch (IOException e) {}
                head = 0;
            }
            return cbuf[head++];
        }

        void back() {
            head--;
        }

        boolean minus() {
            boolean minus;
            while (true) {
                char c = next();
                if (c != ' ' && c != '\n' && c != '\r') {
                    if (!(minus = c == '-')) back();
                    return minus;
                }
            }
        }

        void skip() {
            while (true) {
                char c = next();
                if (c != ' ' && c != '\n' && c != '\r') {
                    back();
                    break;
                }
            }
        }

        char[] s(final int N) {
            skip();
            char[] s = new char[N];
            for (int i = 0; i < s.length; i++) {
                s[i] = next();
            }
            return s;
        }

        int i() {
            boolean minus = minus();
            int n = 0;
            while (true) {
                int k = next() - '0';
                if (k < 0 || 9 < k) break;
                n = 10 * n + k;
            }
            return minus ? -n : n;
        }

        int[] ii(final int N) {
            int[] a = new int[N];
            for (int j = 0; j < a.length; j++) a[j] = i();
            return a;
        }

        long l() {
            boolean minus = minus();
            long n = 0;
            while (true) {
                int k = next() - '0';
                if (k < 0 || 9 < k) break;
                n = 10 * n + k;
            }
            return minus ? -n : n;
        }
    }
} public class Main{
    static MyReader in = new MyReader();

    public static void main(String[] args){
        int X = in.i();
        int N = in.i();
        int[] p = in.ii(N);

        boolean[] b = new boolean[102];
        for (int i = 0; i < N; i++) {
            b[p[i]] = true;
        }

        int ans = X;
        if (b[X]) {
            ans = 0;
            for (int i = X - 1; i > 0; i--) {
                if (!b[i]) {
                    ans = i;
                    break;
                }
            }
            for (int i = X + 1; i < 102; i++) {
                if (!b[i]) {
                    if (i - X < X - ans) {
                        ans = i;
                    }
                    break;
                }
            }
        }
        out.println(ans);
    }

    static class MyReader extends BufferedReader {
        char[] cbuf = new char[1024];
        int head = 0;
        int tail = 0;

        MyReader() {
            super(new InputStreamReader(System.in));
        }

        char next() {
            if (head == tail) {
                try {
                    tail = read(cbuf, 0, cbuf.length);
                } catch (IOException e) {}
                head = 0;
            }
            return cbuf[head++];
        }

        void back() {
            head--;
        }

        boolean minus() {
            boolean minus;
            while (true) {
                char c = next();
                if (c != ' ' && c != '\n' && c != '\r') {
                    if (!(minus = c == '-')) back();
                    return minus;
                }
            }
        }

        void skip() {
            while (true) {
                char c = next();
                if (c != ' ' && c != '\n' && c != '\r') {
                    back();
                    break;
                }
            }
        }

        char[] s(final int N) {
            skip();
            char[] s = new char[N];
            for (int i = 0; i < s.length; i++) {
                s[i] = next();
            }
            return s;
        }

        int i() {
            boolean minus = minus();
            int n = 0;
            while (true) {
                int k = next() - '0';
                if (k < 0 || 9 < k) break;
                n = 10 * n + k;
            }
            return minus ? -n : n;
        }

        int[] ii(final int N) {
            int[] a = new int[N];
            for (int j = 0; j < a.length; j++) a[j] = i();
            return a;
        }

        long l() {
            boolean minus = minus();
            long n = 0;
            while (true) {
                int k = next() - '0';
                if (k < 0 || 9 < k) break;
                n = 10 * n + k;
            }
            return minus ? -n : n;
        }
    }
} Main
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main{
    static MyReader in = new MyReader();

    public static void main(String[] args){
        int X = in.i();
        int N = in.i();
        int[] p = in.ii(N);

        boolean[] b = new boolean[102];
        for (int i = 0; i < N; i++) {
            b[p[i]] = true;
        }

        int ans = X;
        if (b[X]) {
            ans = 0;
            for (int i = X - 1; i > 0; i--) {
                if (!b[i]) {
                    ans = i;
                    break;
                }
            }
            for (int i = X + 1; i < 102; i++) {
                if (!b[i]) {
                    if (i - X < X - ans) {
                        ans = i;
                    }
                    break;
                }
            }
        }
        out.println(ans);
    }

    static class MyReader extends BufferedReader {
        char[] cbuf = new char[1024];
        int head = 0;
        int tail = 0;

        MyReader() {
            super(new InputStreamReader(System.in));
        }

        char next() {
            if (head == tail) {
                try {
                    tail = read(cbuf, 0, cbuf.length);
                } catch (IOException e) {}
                head = 0;
            }
            return cbuf[head++];
        }

        void back() {
            head--;
        }

        boolean minus() {
            boolean minus;
            while (true) {
                char c = next();
                if (c != ' ' && c != '\n' && c != '\r') {
                    if (!(minus = c == '-')) back();
                    return minus;
                }
            }
        }

        void skip() {
            while (true) {
                char c = next();
                if (c != ' ' && c != '\n' && c != '\r') {
                    back();
                    break;
                }
            }
        }

        char[] s(final int N) {
            skip();
            char[] s = new char[N];
            for (int i = 0; i < s.length; i++) {
                s[i] = next();
            }
            return s;
        }

        int i() {
            boolean minus = minus();
            int n = 0;
            while (true) {
                int k = next() - '0';
                if (k < 0 || 9 < k) break;
                n = 10 * n + k;
            }
            return minus ? -n : n;
        }

        int[] ii(final int N) {
            int[] a = new int[N];
            for (int j = 0; j < a.length; j++) a[j] = i();
            return a;
        }

        long l() {
            boolean minus = minus();
            long n = 0;
            while (true) {
                int k = next() - '0';
                if (k < 0 || 9 < k) break;
                n = 10 * n + k;
            }
            return minus ? -n : n;
        }
    }
}
