import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ForbiddenList solver = new ForbiddenList();
        solver.solve(1, in, out);
        out.close();
    }

    static class ForbiddenList {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int x = in.nextInt();
            int n = in.nextInt();

            if (n == 0) {
                out.append(String.valueOf(x));
                return;
            }

            boolean[] p = new boolean[100 + 1];
            for (int i = 0; i < n; i++) {
                int a = in.nextInt();
                p[a] = true;
            }

            int pos = 0;
            while (true) {
                int minus = x - pos;
                if (0 <= minus && minus <= 100) {
                    if (!p[minus]) {
                        out.append(String.valueOf(minus));
                        return;
                    }
                }
                int plus = x + pos;
                if (0 <= plus && plus <= 100) {
                    if (!p[plus]) {
                        out.append(String.valueOf(plus));
                        return;
                    }
                }
                if (minus <= 0) {
                    out.append(String.valueOf(minus));
                    return;
                }

                if (100 < plus) {
                    out.append(String.valueOf(plus));
                    return;
                }
                pos++;
            }
        }

    }
}
 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ForbiddenList solver = new ForbiddenList();
        solver.solve(1, in, out);
        out.close();
    }

    static class ForbiddenList {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int x = in.nextInt();
            int n = in.nextInt();

            if (n == 0) {
                out.append(String.valueOf(x));
                return;
            }

            boolean[] p = new boolean[100 + 1];
            for (int i = 0; i < n; i++) {
                int a = in.nextInt();
                p[a] = true;
            }

            int pos = 0;
            while (true) {
                int minus = x - pos;
                if (0 <= minus && minus <= 100) {
                    if (!p[minus]) {
                        out.append(String.valueOf(minus));
                        return;
                    }
                }
                int plus = x + pos;
                if (0 <= plus && plus <= 100) {
                    if (!p[plus]) {
                        out.append(String.valueOf(plus));
                        return;
                    }
                }
                if (minus <= 0) {
                    out.append(String.valueOf(minus));
                    return;
                }

                if (100 < plus) {
                    out.append(String.valueOf(plus));
                    return;
                }
                pos++;
            }
        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ForbiddenList solver = new ForbiddenList();
        solver.solve(1, in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ForbiddenList solver = new ForbiddenList();
        solver.solve(1, in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out Scanner in = new Scanner(inputStream); in new Scanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) ForbiddenList solver = new ForbiddenList(); solver new ForbiddenList() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class ForbiddenList {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int x = in.nextInt();
            int n = in.nextInt();

            if (n == 0) {
                out.append(String.valueOf(x));
                return;
            }

            boolean[] p = new boolean[100 + 1];
            for (int i = 0; i < n; i++) {
                int a = in.nextInt();
                p[a] = true;
            }

            int pos = 0;
            while (true) {
                int minus = x - pos;
                if (0 <= minus && minus <= 100) {
                    if (!p[minus]) {
                        out.append(String.valueOf(minus));
                        return;
                    }
                }
                int plus = x + pos;
                if (0 <= plus && plus <= 100) {
                    if (!p[plus]) {
                        out.append(String.valueOf(plus));
                        return;
                    }
                }
                if (minus <= 0) {
                    out.append(String.valueOf(minus));
                    return;
                }

                if (100 < plus) {
                    out.append(String.valueOf(plus));
                    return;
                }
                pos++;
            }
        }

    } ForbiddenList public void solve(int testNumber, Scanner in, PrintWriter out) {
            int x = in.nextInt();
            int n = in.nextInt();

            if (n == 0) {
                out.append(String.valueOf(x));
                return;
            }

            boolean[] p = new boolean[100 + 1];
            for (int i = 0; i < n; i++) {
                int a = in.nextInt();
                p[a] = true;
            }

            int pos = 0;
            while (true) {
                int minus = x - pos;
                if (0 <= minus && minus <= 100) {
                    if (!p[minus]) {
                        out.append(String.valueOf(minus));
                        return;
                    }
                }
                int plus = x + pos;
                if (0 <= plus && plus <= 100) {
                    if (!p[plus]) {
                        out.append(String.valueOf(plus));
                        return;
                    }
                }
                if (minus <= 0) {
                    out.append(String.valueOf(minus));
                    return;
                }

                if (100 < plus) {
                    out.append(String.valueOf(plus));
                    return;
                }
                pos++;
            }
        } solve {
            int x = in.nextInt();
            int n = in.nextInt();

            if (n == 0) {
                out.append(String.valueOf(x));
                return;
            }

            boolean[] p = new boolean[100 + 1];
            for (int i = 0; i < n; i++) {
                int a = in.nextInt();
                p[a] = true;
            }

            int pos = 0;
            while (true) {
                int minus = x - pos;
                if (0 <= minus && minus <= 100) {
                    if (!p[minus]) {
                        out.append(String.valueOf(minus));
                        return;
                    }
                }
                int plus = x + pos;
                if (0 <= plus && plus <= 100) {
                    if (!p[plus]) {
                        out.append(String.valueOf(plus));
                        return;
                    }
                }
                if (minus <= 0) {
                    out.append(String.valueOf(minus));
                    return;
                }

                if (100 < plus) {
                    out.append(String.valueOf(plus));
                    return;
                }
                pos++;
            }
        } int x = in.nextInt(); x in.nextInt() in.nextInt in int n = in.nextInt(); n in.nextInt() in.nextInt in if (n == 0) {
                out.append(String.valueOf(x));
                return;
            } n == 0 n 0 {
                out.append(String.valueOf(x));
                return;
            } out.append(String.valueOf(x)) out.append out String.valueOf(x) String.valueOf String x return; boolean[] p = new boolean[100 + 1]; p new boolean[100 + 1] 100 + 1 100 1 for (int i = 0; i < n; i++) {
                int a = in.nextInt();
                p[a] = true;
            } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
                int a = in.nextInt();
                p[a] = true;
            } {
                int a = in.nextInt();
                p[a] = true;
            } int a = in.nextInt(); a in.nextInt() in.nextInt in p[a] = true p[a] p a true int pos = 0; pos 0 while (true) {
                int minus = x - pos;
                if (0 <= minus && minus <= 100) {
                    if (!p[minus]) {
                        out.append(String.valueOf(minus));
                        return;
                    }
                }
                int plus = x + pos;
                if (0 <= plus && plus <= 100) {
                    if (!p[plus]) {
                        out.append(String.valueOf(plus));
                        return;
                    }
                }
                if (minus <= 0) {
                    out.append(String.valueOf(minus));
                    return;
                }

                if (100 < plus) {
                    out.append(String.valueOf(plus));
                    return;
                }
                pos++;
            } true {
                int minus = x - pos;
                if (0 <= minus && minus <= 100) {
                    if (!p[minus]) {
                        out.append(String.valueOf(minus));
                        return;
                    }
                }
                int plus = x + pos;
                if (0 <= plus && plus <= 100) {
                    if (!p[plus]) {
                        out.append(String.valueOf(plus));
                        return;
                    }
                }
                if (minus <= 0) {
                    out.append(String.valueOf(minus));
                    return;
                }

                if (100 < plus) {
                    out.append(String.valueOf(plus));
                    return;
                }
                pos++;
            } int minus = x - pos; minus x - pos x pos if (0 <= minus && minus <= 100) {
                    if (!p[minus]) {
                        out.append(String.valueOf(minus));
                        return;
                    }
                } 0 <= minus && minus <= 100 0 <= minus 0 minus minus <= 100 minus 100 {
                    if (!p[minus]) {
                        out.append(String.valueOf(minus));
                        return;
                    }
                } if (!p[minus]) {
                        out.append(String.valueOf(minus));
                        return;
                    } !p[minus] p[minus] p minus {
                        out.append(String.valueOf(minus));
                        return;
                    } out.append(String.valueOf(minus)) out.append out String.valueOf(minus) String.valueOf String minus return; int plus = x + pos; plus x + pos x pos if (0 <= plus && plus <= 100) {
                    if (!p[plus]) {
                        out.append(String.valueOf(plus));
                        return;
                    }
                } 0 <= plus && plus <= 100 0 <= plus 0 plus plus <= 100 plus 100 {
                    if (!p[plus]) {
                        out.append(String.valueOf(plus));
                        return;
                    }
                } if (!p[plus]) {
                        out.append(String.valueOf(plus));
                        return;
                    } !p[plus] p[plus] p plus {
                        out.append(String.valueOf(plus));
                        return;
                    } out.append(String.valueOf(plus)) out.append out String.valueOf(plus) String.valueOf String plus return; if (minus <= 0) {
                    out.append(String.valueOf(minus));
                    return;
                } minus <= 0 minus 0 {
                    out.append(String.valueOf(minus));
                    return;
                } out.append(String.valueOf(minus)) out.append out String.valueOf(minus) String.valueOf String minus return; if (100 < plus) {
                    out.append(String.valueOf(plus));
                    return;
                } 100 < plus 100 plus {
                    out.append(String.valueOf(plus));
                    return;
                } out.append(String.valueOf(plus)) out.append out String.valueOf(plus) String.valueOf String plus return; pos++ pos int testNumber testNumber Scanner in in PrintWriter out out public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ForbiddenList solver = new ForbiddenList();
        solver.solve(1, in, out);
        out.close();
    }

    static class ForbiddenList {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int x = in.nextInt();
            int n = in.nextInt();

            if (n == 0) {
                out.append(String.valueOf(x));
                return;
            }

            boolean[] p = new boolean[100 + 1];
            for (int i = 0; i < n; i++) {
                int a = in.nextInt();
                p[a] = true;
            }

            int pos = 0;
            while (true) {
                int minus = x - pos;
                if (0 <= minus && minus <= 100) {
                    if (!p[minus]) {
                        out.append(String.valueOf(minus));
                        return;
                    }
                }
                int plus = x + pos;
                if (0 <= plus && plus <= 100) {
                    if (!p[plus]) {
                        out.append(String.valueOf(plus));
                        return;
                    }
                }
                if (minus <= 0) {
                    out.append(String.valueOf(minus));
                    return;
                }

                if (100 < plus) {
                    out.append(String.valueOf(plus));
                    return;
                }
                pos++;
            }
        }

    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ForbiddenList solver = new ForbiddenList();
        solver.solve(1, in, out);
        out.close();
    }

    static class ForbiddenList {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int x = in.nextInt();
            int n = in.nextInt();

            if (n == 0) {
                out.append(String.valueOf(x));
                return;
            }

            boolean[] p = new boolean[100 + 1];
            for (int i = 0; i < n; i++) {
                int a = in.nextInt();
                p[a] = true;
            }

            int pos = 0;
            while (true) {
                int minus = x - pos;
                if (0 <= minus && minus <= 100) {
                    if (!p[minus]) {
                        out.append(String.valueOf(minus));
                        return;
                    }
                }
                int plus = x + pos;
                if (0 <= plus && plus <= 100) {
                    if (!p[plus]) {
                        out.append(String.valueOf(plus));
                        return;
                    }
                }
                if (minus <= 0) {
                    out.append(String.valueOf(minus));
                    return;
                }

                if (100 < plus) {
                    out.append(String.valueOf(plus));
                    return;
                }
                pos++;
            }
        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ForbiddenList solver = new ForbiddenList();
        solver.solve(1, in, out);
        out.close();
    }

    static class ForbiddenList {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int x = in.nextInt();
            int n = in.nextInt();

            if (n == 0) {
                out.append(String.valueOf(x));
                return;
            }

            boolean[] p = new boolean[100 + 1];
            for (int i = 0; i < n; i++) {
                int a = in.nextInt();
                p[a] = true;
            }

            int pos = 0;
            while (true) {
                int minus = x - pos;
                if (0 <= minus && minus <= 100) {
                    if (!p[minus]) {
                        out.append(String.valueOf(minus));
                        return;
                    }
                }
                int plus = x + pos;
                if (0 <= plus && plus <= 100) {
                    if (!p[plus]) {
                        out.append(String.valueOf(plus));
                        return;
                    }
                }
                if (minus <= 0) {
                    out.append(String.valueOf(minus));
                    return;
                }

                if (100 < plus) {
                    out.append(String.valueOf(plus));
                    return;
                }
                pos++;
            }
        }

    }
}

