import java.util.InputMismatchException;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStream;

public class Main {
    InputStream is;

    int __t__ = 1;
    int __f__ = 0;
    int __FILE_DEBUG_FLAG__ = __f__;
    String __DEBUG_FILE_NAME__ = "src/O1";

    FastScanner in;
    PrintWriter out;

    public void solve() {
        int x = in.nextInt(), n = in.nextInt();
        int[] a = in.nextIntArray(n);

        int[] cnt = new int[301];
        for (int i = 0; i < n; i++) {
            cnt[a[i]]++;
        }

        int res = 0;
        for (int i = 0; i < cnt.length; i++) {
            if (cnt[i] == 0 && Math.abs(x - i) < Math.abs(x - res)) {
                res = i;
            }
        }
        System.out.println(res);
    }

    public void run() {
        if (__FILE_DEBUG_FLAG__ == __t__) {
            try {
                is = new FileInputStream(__DEBUG_FILE_NAME__);
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
            System.out.println("FILE_INPUT!");
        } else {
            is = System.in;
        }
        in = new FastScanner(is);
        out = new PrintWriter(System.out);

        solve();
    }

    public static void main(final String[] args) {
        new Main().run();
    }
}


class FastScanner {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public FastScanner(InputStream stream) {
        this.stream = stream;
        // stream = new FileInputStream(new File("dec.in"));
    }

    int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public boolean isEndline(int c) {
        return c == '\n' || c == '\r' || c == -1;
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public int[] nextIntArray(int n) {
        int[] array = new int[n];
        for (int i = 0; i < n; i++)
            array[i] = nextInt();

        return array;
    }

    public int[][] nextIntMap(int n, int m) {
        int[][] map = new int[n][m];
        for (int i = 0; i < n; i++) {
            map[i] = nextIntArray(m);
        }
        return map;
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public long[] nextLongArray(int n) {
        long[] array = new long[n];
        for (int i = 0; i < n; i++)
            array[i] = nextLong();

        return array;
    }

    public long[][] nextLongMap(int n, int m) {
        long[][] map = new long[n][m];
        for (int i = 0; i < n; i++) {
            map[i] = nextLongArray(m);
        }
        return map;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }

    public double[] nextDoubleArray(int n) {
        double[] array = new double[n];
        for (int i = 0; i < n; i++)
            array[i] = nextDouble();

        return array;
    }

    public double[][] nextDoubleMap(int n, int m) {
        double[][] map = new double[n][m];
        for (int i = 0; i < n; i++) {
            map[i] = nextDoubleArray(m);
        }
        return map;
    }

    public String next() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public String[] nextStringArray(int n) {
        String[] array = new String[n];
        for (int i = 0; i < n; i++)
            array[i] = next();

        return array;
    }

    public String nextLine() {
        int c = read();
        while (isEndline(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isEndline(c));
        return res.toString();
    }

    public int[][] nextPackedIntArrays(int packN, int size) {
        int[][] res = new int[packN][size];
        for (int i = 0; i < size; i++) {
            for (int j = 0; j < packN; j++) {
                res[j][i] = nextInt();
            }
        }
        return res;
    }
} import java.util.InputMismatchException; InputMismatchException java.util import java.io.FileInputStream; FileInputStream java.io import java.io.FileNotFoundException; FileNotFoundException java.io import java.io.PrintWriter; PrintWriter java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io public class Main {
    InputStream is;

    int __t__ = 1;
    int __f__ = 0;
    int __FILE_DEBUG_FLAG__ = __f__;
    String __DEBUG_FILE_NAME__ = "src/O1";

    FastScanner in;
    PrintWriter out;

    public void solve() {
        int x = in.nextInt(), n = in.nextInt();
        int[] a = in.nextIntArray(n);

        int[] cnt = new int[301];
        for (int i = 0; i < n; i++) {
            cnt[a[i]]++;
        }

        int res = 0;
        for (int i = 0; i < cnt.length; i++) {
            if (cnt[i] == 0 && Math.abs(x - i) < Math.abs(x - res)) {
                res = i;
            }
        }
        System.out.println(res);
    }

    public void run() {
        if (__FILE_DEBUG_FLAG__ == __t__) {
            try {
                is = new FileInputStream(__DEBUG_FILE_NAME__);
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
            System.out.println("FILE_INPUT!");
        } else {
            is = System.in;
        }
        in = new FastScanner(is);
        out = new PrintWriter(System.out);

        solve();
    }

    public static void main(final String[] args) {
        new Main().run();
    }
} Main InputStream is; is int __t__ = 1; __t__ 1 int __f__ = 0; __f__ 0 int __FILE_DEBUG_FLAG__ = __f__; __FILE_DEBUG_FLAG__ __f__ String __DEBUG_FILE_NAME__ = "src/O1"; __DEBUG_FILE_NAME__ "src/O1" FastScanner in; in PrintWriter out; out public void solve() {
        int x = in.nextInt(), n = in.nextInt();
        int[] a = in.nextIntArray(n);

        int[] cnt = new int[301];
        for (int i = 0; i < n; i++) {
            cnt[a[i]]++;
        }

        int res = 0;
        for (int i = 0; i < cnt.length; i++) {
            if (cnt[i] == 0 && Math.abs(x - i) < Math.abs(x - res)) {
                res = i;
            }
        }
        System.out.println(res);
    } solve {
        int x = in.nextInt(), n = in.nextInt();
        int[] a = in.nextIntArray(n);

        int[] cnt = new int[301];
        for (int i = 0; i < n; i++) {
            cnt[a[i]]++;
        }

        int res = 0;
        for (int i = 0; i < cnt.length; i++) {
            if (cnt[i] == 0 && Math.abs(x - i) < Math.abs(x - res)) {
                res = i;
            }
        }
        System.out.println(res);
    } int x = in.nextInt() x in.nextInt() in.nextInt in n = in.nextInt(); n in.nextInt() in.nextInt in int[] a = in.nextIntArray(n); a in.nextIntArray(n) in.nextIntArray in n int[] cnt = new int[301]; cnt new int[301] 301 for (int i = 0; i < n; i++) {
            cnt[a[i]]++;
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            cnt[a[i]]++;
        } {
            cnt[a[i]]++;
        } cnt[a[i]]++ cnt[a[i]] cnt a[i] a i int res = 0; res 0 for (int i = 0; i < cnt.length; i++) {
            if (cnt[i] == 0 && Math.abs(x - i) < Math.abs(x - res)) {
                res = i;
            }
        } int i = 0; int i = 0; i 0 i < cnt.length i cnt.length cnt cnt.length i++ i++ i {
            if (cnt[i] == 0 && Math.abs(x - i) < Math.abs(x - res)) {
                res = i;
            }
        } {
            if (cnt[i] == 0 && Math.abs(x - i) < Math.abs(x - res)) {
                res = i;
            }
        } if (cnt[i] == 0 && Math.abs(x - i) < Math.abs(x - res)) {
                res = i;
            } cnt[i] == 0 && Math.abs(x - i) < Math.abs(x - res) cnt[i] == 0 cnt[i] cnt i 0 Math.abs(x - i) < Math.abs(x - res) Math.abs(x - i) Math.abs Math x - i x i Math.abs(x - res) Math.abs Math x - res x res {
                res = i;
            } res = i res i System.out.println(res) System.out.println System.out System System.out res public void run() {
        if (__FILE_DEBUG_FLAG__ == __t__) {
            try {
                is = new FileInputStream(__DEBUG_FILE_NAME__);
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
            System.out.println("FILE_INPUT!");
        } else {
            is = System.in;
        }
        in = new FastScanner(is);
        out = new PrintWriter(System.out);

        solve();
    } run {
        if (__FILE_DEBUG_FLAG__ == __t__) {
            try {
                is = new FileInputStream(__DEBUG_FILE_NAME__);
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
            System.out.println("FILE_INPUT!");
        } else {
            is = System.in;
        }
        in = new FastScanner(is);
        out = new PrintWriter(System.out);

        solve();
    } if (__FILE_DEBUG_FLAG__ == __t__) {
            try {
                is = new FileInputStream(__DEBUG_FILE_NAME__);
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
            System.out.println("FILE_INPUT!");
        } else {
            is = System.in;
        } __FILE_DEBUG_FLAG__ == __t__ __FILE_DEBUG_FLAG__ __t__ {
            try {
                is = new FileInputStream(__DEBUG_FILE_NAME__);
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
            System.out.println("FILE_INPUT!");
        } try {
                is = new FileInputStream(__DEBUG_FILE_NAME__);
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } FileNotFoundException e {
                e.printStackTrace();
            } e.printStackTrace() e.printStackTrace e {
                is = new FileInputStream(__DEBUG_FILE_NAME__);
            } is = new FileInputStream(__DEBUG_FILE_NAME__) is new FileInputStream(__DEBUG_FILE_NAME__) System.out.println("FILE_INPUT!") System.out.println System.out System System.out "FILE_INPUT!" {
            is = System.in;
        } is = System.in is System.in System System.in in = new FastScanner(is) in new FastScanner(is) out = new PrintWriter(System.out) out new PrintWriter(System.out) solve() solve public static void main(final String[] args) {
        new Main().run();
    } main {
        new Main().run();
    } new Main().run() new Main().run new Main() final String[] args args class FastScanner {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public FastScanner(InputStream stream) {
        this.stream = stream;
        // stream = new FileInputStream(new File("dec.in"));
    }

    int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public boolean isEndline(int c) {
        return c == '\n' || c == '\r' || c == -1;
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public int[] nextIntArray(int n) {
        int[] array = new int[n];
        for (int i = 0; i < n; i++)
            array[i] = nextInt();

        return array;
    }

    public int[][] nextIntMap(int n, int m) {
        int[][] map = new int[n][m];
        for (int i = 0; i < n; i++) {
            map[i] = nextIntArray(m);
        }
        return map;
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public long[] nextLongArray(int n) {
        long[] array = new long[n];
        for (int i = 0; i < n; i++)
            array[i] = nextLong();

        return array;
    }

    public long[][] nextLongMap(int n, int m) {
        long[][] map = new long[n][m];
        for (int i = 0; i < n; i++) {
            map[i] = nextLongArray(m);
        }
        return map;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }

    public double[] nextDoubleArray(int n) {
        double[] array = new double[n];
        for (int i = 0; i < n; i++)
            array[i] = nextDouble();

        return array;
    }

    public double[][] nextDoubleMap(int n, int m) {
        double[][] map = new double[n][m];
        for (int i = 0; i < n; i++) {
            map[i] = nextDoubleArray(m);
        }
        return map;
    }

    public String next() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public String[] nextStringArray(int n) {
        String[] array = new String[n];
        for (int i = 0; i < n; i++)
            array[i] = next();

        return array;
    }

    public String nextLine() {
        int c = read();
        while (isEndline(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isEndline(c));
        return res.toString();
    }

    public int[][] nextPackedIntArrays(int packN, int size) {
        int[][] res = new int[packN][size];
        for (int i = 0; i < size; i++) {
            for (int j = 0; j < packN; j++) {
                res[j][i] = nextInt();
            }
        }
        return res;
    }
} FastScanner private InputStream stream; stream private byte[] buf = new byte[1024]; buf new byte[1024] 1024 private int curChar; curChar private int numChars; numChars public FastScanner(InputStream stream) {
        this.stream = stream;
        // stream = new FileInputStream(new File("dec.in"));
    } FastScanner {
        this.stream = stream;
        // stream = new FileInputStream(new File("dec.in"));
    } this.stream = stream this.stream this this.stream stream InputStream stream stream int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    } read {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    } if (numChars == -1)
            throw new InputMismatchException(); numChars == -1 numChars -1 1 throw new InputMismatchException(); new InputMismatchException() if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        } curChar >= numChars curChar numChars {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        } curChar = 0 curChar 0 try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            } catch (IOException e) {
                throw new InputMismatchException();
            } IOException e {
                throw new InputMismatchException();
            } throw new InputMismatchException(); new InputMismatchException() {
                numChars = stream.read(buf);
            } numChars = stream.read(buf) numChars stream.read(buf) stream.read stream buf if (numChars <= 0)
                return -1; numChars <= 0 numChars 0 return -1; -1 1 return buf[curChar++]; buf[curChar++] buf curChar++ curChar public boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    } isSpaceChar {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    } return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1 c == '\t' c == '\r' c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1 c == ' ' c ' ' c == '\n' c '\n' c == '\r' c '\r' c == '\t' c '\t' c == -1 c -1 1 int c c public boolean isEndline(int c) {
        return c == '\n' || c == '\r' || c == -1;
    } isEndline {
        return c == '\n' || c == '\r' || c == -1;
    } return c == '\n' || c == '\r' || c == -1; c == '\n' || c == '\r' || c == -1 c == '\n' || c == '\r' || c == -1 c == '\n' c '\n' c == '\r' c '\r' c == -1 c -1 1 int c c public int nextInt() {
        return Integer.parseInt(next());
    } nextInt {
        return Integer.parseInt(next());
    } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public int[] nextIntArray(int n) {
        int[] array = new int[n];
        for (int i = 0; i < n; i++)
            array[i] = nextInt();

        return array;
    } nextIntArray {
        int[] array = new int[n];
        for (int i = 0; i < n; i++)
            array[i] = nextInt();

        return array;
    } int[] array = new int[n]; array new int[n] n for (int i = 0; i < n; i++)
            array[i] = nextInt(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i array[i] = nextInt(); array[i] = nextInt() array[i] array i nextInt() nextInt return array; array int n n public int[][] nextIntMap(int n, int m) {
        int[][] map = new int[n][m];
        for (int i = 0; i < n; i++) {
            map[i] = nextIntArray(m);
        }
        return map;
    } nextIntMap {
        int[][] map = new int[n][m];
        for (int i = 0; i < n; i++) {
            map[i] = nextIntArray(m);
        }
        return map;
    } int[][] map = new int[n][m]; map new int[n][m] n m for (int i = 0; i < n; i++) {
            map[i] = nextIntArray(m);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            map[i] = nextIntArray(m);
        } {
            map[i] = nextIntArray(m);
        } map[i] = nextIntArray(m) map[i] map i nextIntArray(m) nextIntArray m return map; map int n n int m m public long nextLong() {
        return Long.parseLong(next());
    } nextLong {
        return Long.parseLong(next());
    } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public long[] nextLongArray(int n) {
        long[] array = new long[n];
        for (int i = 0; i < n; i++)
            array[i] = nextLong();

        return array;
    } nextLongArray {
        long[] array = new long[n];
        for (int i = 0; i < n; i++)
            array[i] = nextLong();

        return array;
    } long[] array = new long[n]; array new long[n] n for (int i = 0; i < n; i++)
            array[i] = nextLong(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i array[i] = nextLong(); array[i] = nextLong() array[i] array i nextLong() nextLong return array; array int n n public long[][] nextLongMap(int n, int m) {
        long[][] map = new long[n][m];
        for (int i = 0; i < n; i++) {
            map[i] = nextLongArray(m);
        }
        return map;
    } nextLongMap {
        long[][] map = new long[n][m];
        for (int i = 0; i < n; i++) {
            map[i] = nextLongArray(m);
        }
        return map;
    } long[][] map = new long[n][m]; map new long[n][m] n m for (int i = 0; i < n; i++) {
            map[i] = nextLongArray(m);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            map[i] = nextLongArray(m);
        } {
            map[i] = nextLongArray(m);
        } map[i] = nextLongArray(m) map[i] map i nextLongArray(m) nextLongArray m return map; map int n n int m m public double nextDouble() {
        return Double.parseDouble(next());
    } nextDouble {
        return Double.parseDouble(next());
    } return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next public double[] nextDoubleArray(int n) {
        double[] array = new double[n];
        for (int i = 0; i < n; i++)
            array[i] = nextDouble();

        return array;
    } nextDoubleArray {
        double[] array = new double[n];
        for (int i = 0; i < n; i++)
            array[i] = nextDouble();

        return array;
    } double[] array = new double[n]; array new double[n] n for (int i = 0; i < n; i++)
            array[i] = nextDouble(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i array[i] = nextDouble(); array[i] = nextDouble() array[i] array i nextDouble() nextDouble return array; array int n n public double[][] nextDoubleMap(int n, int m) {
        double[][] map = new double[n][m];
        for (int i = 0; i < n; i++) {
            map[i] = nextDoubleArray(m);
        }
        return map;
    } nextDoubleMap {
        double[][] map = new double[n][m];
        for (int i = 0; i < n; i++) {
            map[i] = nextDoubleArray(m);
        }
        return map;
    } double[][] map = new double[n][m]; map new double[n][m] n m for (int i = 0; i < n; i++) {
            map[i] = nextDoubleArray(m);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            map[i] = nextDoubleArray(m);
        } {
            map[i] = nextDoubleArray(m);
        } map[i] = nextDoubleArray(m) map[i] map i nextDoubleArray(m) nextDoubleArray m return map; map int n n int m m public String next() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    } next {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    } int c = read(); c read() read while (isSpaceChar(c))
            c = read(); isSpaceChar(c) isSpaceChar c c = read() c read() read StringBuilder res = new StringBuilder(); res new StringBuilder() do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c)); !isSpaceChar(c) isSpaceChar(c) isSpaceChar c {
            res.appendCodePoint(c);
            c = read();
        } res.appendCodePoint(c) res.appendCodePoint res c c = read() c read() read return res.toString(); res.toString() res.toString res public String[] nextStringArray(int n) {
        String[] array = new String[n];
        for (int i = 0; i < n; i++)
            array[i] = next();

        return array;
    } nextStringArray {
        String[] array = new String[n];
        for (int i = 0; i < n; i++)
            array[i] = next();

        return array;
    } String[] array = new String[n]; array new String[n] n for (int i = 0; i < n; i++)
            array[i] = next(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i array[i] = next(); array[i] = next() array[i] array i next() next return array; array int n n public String nextLine() {
        int c = read();
        while (isEndline(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isEndline(c));
        return res.toString();
    } nextLine {
        int c = read();
        while (isEndline(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isEndline(c));
        return res.toString();
    } int c = read(); c read() read while (isEndline(c))
            c = read(); isEndline(c) isEndline c c = read() c read() read StringBuilder res = new StringBuilder(); res new StringBuilder() do {
            res.appendCodePoint(c);
            c = read();
        } while (!isEndline(c)); !isEndline(c) isEndline(c) isEndline c {
            res.appendCodePoint(c);
            c = read();
        } res.appendCodePoint(c) res.appendCodePoint res c c = read() c read() read return res.toString(); res.toString() res.toString res public int[][] nextPackedIntArrays(int packN, int size) {
        int[][] res = new int[packN][size];
        for (int i = 0; i < size; i++) {
            for (int j = 0; j < packN; j++) {
                res[j][i] = nextInt();
            }
        }
        return res;
    } nextPackedIntArrays {
        int[][] res = new int[packN][size];
        for (int i = 0; i < size; i++) {
            for (int j = 0; j < packN; j++) {
                res[j][i] = nextInt();
            }
        }
        return res;
    } int[][] res = new int[packN][size]; res new int[packN][size] packN size for (int i = 0; i < size; i++) {
            for (int j = 0; j < packN; j++) {
                res[j][i] = nextInt();
            }
        } int i = 0; int i = 0; i 0 i < size i size i++ i++ i {
            for (int j = 0; j < packN; j++) {
                res[j][i] = nextInt();
            }
        } {
            for (int j = 0; j < packN; j++) {
                res[j][i] = nextInt();
            }
        } for (int j = 0; j < packN; j++) {
                res[j][i] = nextInt();
            } int j = 0; int j = 0; j 0 j < packN j packN j++ j++ j {
                res[j][i] = nextInt();
            } {
                res[j][i] = nextInt();
            } res[j][i] = nextInt() res[j][i] res[j] res j i nextInt() nextInt return res; res int packN packN int size size public class Main {
    InputStream is;

    int __t__ = 1;
    int __f__ = 0;
    int __FILE_DEBUG_FLAG__ = __f__;
    String __DEBUG_FILE_NAME__ = "src/O1";

    FastScanner in;
    PrintWriter out;

    public void solve() {
        int x = in.nextInt(), n = in.nextInt();
        int[] a = in.nextIntArray(n);

        int[] cnt = new int[301];
        for (int i = 0; i < n; i++) {
            cnt[a[i]]++;
        }

        int res = 0;
        for (int i = 0; i < cnt.length; i++) {
            if (cnt[i] == 0 && Math.abs(x - i) < Math.abs(x - res)) {
                res = i;
            }
        }
        System.out.println(res);
    }

    public void run() {
        if (__FILE_DEBUG_FLAG__ == __t__) {
            try {
                is = new FileInputStream(__DEBUG_FILE_NAME__);
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
            System.out.println("FILE_INPUT!");
        } else {
            is = System.in;
        }
        in = new FastScanner(is);
        out = new PrintWriter(System.out);

        solve();
    }

    public static void main(final String[] args) {
        new Main().run();
    }
} public class Main {
    InputStream is;

    int __t__ = 1;
    int __f__ = 0;
    int __FILE_DEBUG_FLAG__ = __f__;
    String __DEBUG_FILE_NAME__ = "src/O1";

    FastScanner in;
    PrintWriter out;

    public void solve() {
        int x = in.nextInt(), n = in.nextInt();
        int[] a = in.nextIntArray(n);

        int[] cnt = new int[301];
        for (int i = 0; i < n; i++) {
            cnt[a[i]]++;
        }

        int res = 0;
        for (int i = 0; i < cnt.length; i++) {
            if (cnt[i] == 0 && Math.abs(x - i) < Math.abs(x - res)) {
                res = i;
            }
        }
        System.out.println(res);
    }

    public void run() {
        if (__FILE_DEBUG_FLAG__ == __t__) {
            try {
                is = new FileInputStream(__DEBUG_FILE_NAME__);
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
            System.out.println("FILE_INPUT!");
        } else {
            is = System.in;
        }
        in = new FastScanner(is);
        out = new PrintWriter(System.out);

        solve();
    }

    public static void main(final String[] args) {
        new Main().run();
    }
} Main
import java.util.InputMismatchException;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStream;

public class Main {
    InputStream is;

    int __t__ = 1;
    int __f__ = 0;
    int __FILE_DEBUG_FLAG__ = __f__;
    String __DEBUG_FILE_NAME__ = "src/O1";

    FastScanner in;
    PrintWriter out;

    public void solve() {
        int x = in.nextInt(), n = in.nextInt();
        int[] a = in.nextIntArray(n);

        int[] cnt = new int[301];
        for (int i = 0; i < n; i++) {
            cnt[a[i]]++;
        }

        int res = 0;
        for (int i = 0; i < cnt.length; i++) {
            if (cnt[i] == 0 && Math.abs(x - i) < Math.abs(x - res)) {
                res = i;
            }
        }
        System.out.println(res);
    }

    public void run() {
        if (__FILE_DEBUG_FLAG__ == __t__) {
            try {
                is = new FileInputStream(__DEBUG_FILE_NAME__);
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
            System.out.println("FILE_INPUT!");
        } else {
            is = System.in;
        }
        in = new FastScanner(is);
        out = new PrintWriter(System.out);

        solve();
    }

    public static void main(final String[] args) {
        new Main().run();
    }
}


class FastScanner {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public FastScanner(InputStream stream) {
        this.stream = stream;
        // stream = new FileInputStream(new File("dec.in"));
    }

    int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public boolean isEndline(int c) {
        return c == '\n' || c == '\r' || c == -1;
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public int[] nextIntArray(int n) {
        int[] array = new int[n];
        for (int i = 0; i < n; i++)
            array[i] = nextInt();

        return array;
    }

    public int[][] nextIntMap(int n, int m) {
        int[][] map = new int[n][m];
        for (int i = 0; i < n; i++) {
            map[i] = nextIntArray(m);
        }
        return map;
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public long[] nextLongArray(int n) {
        long[] array = new long[n];
        for (int i = 0; i < n; i++)
            array[i] = nextLong();

        return array;
    }

    public long[][] nextLongMap(int n, int m) {
        long[][] map = new long[n][m];
        for (int i = 0; i < n; i++) {
            map[i] = nextLongArray(m);
        }
        return map;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }

    public double[] nextDoubleArray(int n) {
        double[] array = new double[n];
        for (int i = 0; i < n; i++)
            array[i] = nextDouble();

        return array;
    }

    public double[][] nextDoubleMap(int n, int m) {
        double[][] map = new double[n][m];
        for (int i = 0; i < n; i++) {
            map[i] = nextDoubleArray(m);
        }
        return map;
    }

    public String next() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public String[] nextStringArray(int n) {
        String[] array = new String[n];
        for (int i = 0; i < n; i++)
            array[i] = next();

        return array;
    }

    public String nextLine() {
        int c = read();
        while (isEndline(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isEndline(c));
        return res.toString();
    }

    public int[][] nextPackedIntArrays(int packN, int size) {
        int[][] res = new int[packN][size];
        for (int i = 0; i < size; i++) {
            for (int j = 0; j < packN; j++) {
                res[j][i] = nextInt();
            }
        }
        return res;
    }
}
