import java.io.IOException;
import java.math.BigInteger;
import java.util.ArrayList;

public class Main {
    private static StringBuilder builder = new StringBuilder();
    public static void main(String[] args) {
        int x = readInt();
        int n = readInt();
        ArrayList<Integer> list = new ArrayList<>(n);
        for (int i = 0; i < n; i++) {
            list.add(readInt());
        }

        int i = 0;
        while (true) {
            if (!list.contains(x - i)) {
                System.out.print(x - i);
                break;
            }

            if (!list.contains(x + i)) {
                System.out.print(x + i);
                break;
            }

            list.remove(Integer.valueOf(x - i));
            list.remove(Integer.valueOf(x + i));
            if (x + i == Integer.MAX_VALUE || x - i == Integer.MIN_VALUE) {
                break;
            }

            i++;
        }
    }

    private static void read() {
        builder.setLength(0);
        while (true) {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) {
                    break;
                } else {
                    builder.appendCodePoint(b);
                }
            } catch (IOException e) {
                break;
            }
        }
    }

    private static int readInt() {
        read();
        return Integer.parseInt(builder.toString());
    }

    private static int readInt(int radix) {
        read();
        return Integer.parseInt(builder.toString(), radix);
    }

    private static long readLong() {
        read();
        return Long.parseLong(builder.toString());
    }

    private static long readLong(int radix) {
        read();
        return Long.parseLong(builder.toString(), radix);
    }

    private static BigInteger readBigInteger() {
        read();
        return new BigInteger(builder.toString());
    }

    private static BigInteger readBigInteger(int radix) {
        read();
        return new BigInteger(builder.toString(), radix);
    }

    private static void skipLine() {
        while (true) {
            try {
                int b = System.in.read();
                if (b == '\n' || b == -1) {
                    break;
                }
            } catch (IOException e) {
                break;
            }
        }
    }

    private static void skip() {
        while (true) {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) break;
            } catch (IOException e) {
                break;
            }
        }
    }

} import java.io.IOException; IOException java.io import java.math.BigInteger; BigInteger java.math import java.util.ArrayList; ArrayList java.util public class Main {
    private static StringBuilder builder = new StringBuilder();
    public static void main(String[] args) {
        int x = readInt();
        int n = readInt();
        ArrayList<Integer> list = new ArrayList<>(n);
        for (int i = 0; i < n; i++) {
            list.add(readInt());
        }

        int i = 0;
        while (true) {
            if (!list.contains(x - i)) {
                System.out.print(x - i);
                break;
            }

            if (!list.contains(x + i)) {
                System.out.print(x + i);
                break;
            }

            list.remove(Integer.valueOf(x - i));
            list.remove(Integer.valueOf(x + i));
            if (x + i == Integer.MAX_VALUE || x - i == Integer.MIN_VALUE) {
                break;
            }

            i++;
        }
    }

    private static void read() {
        builder.setLength(0);
        while (true) {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) {
                    break;
                } else {
                    builder.appendCodePoint(b);
                }
            } catch (IOException e) {
                break;
            }
        }
    }

    private static int readInt() {
        read();
        return Integer.parseInt(builder.toString());
    }

    private static int readInt(int radix) {
        read();
        return Integer.parseInt(builder.toString(), radix);
    }

    private static long readLong() {
        read();
        return Long.parseLong(builder.toString());
    }

    private static long readLong(int radix) {
        read();
        return Long.parseLong(builder.toString(), radix);
    }

    private static BigInteger readBigInteger() {
        read();
        return new BigInteger(builder.toString());
    }

    private static BigInteger readBigInteger(int radix) {
        read();
        return new BigInteger(builder.toString(), radix);
    }

    private static void skipLine() {
        while (true) {
            try {
                int b = System.in.read();
                if (b == '\n' || b == -1) {
                    break;
                }
            } catch (IOException e) {
                break;
            }
        }
    }

    private static void skip() {
        while (true) {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) break;
            } catch (IOException e) {
                break;
            }
        }
    }

} Main private static StringBuilder builder = new StringBuilder(); builder new StringBuilder() public static void main(String[] args) {
        int x = readInt();
        int n = readInt();
        ArrayList<Integer> list = new ArrayList<>(n);
        for (int i = 0; i < n; i++) {
            list.add(readInt());
        }

        int i = 0;
        while (true) {
            if (!list.contains(x - i)) {
                System.out.print(x - i);
                break;
            }

            if (!list.contains(x + i)) {
                System.out.print(x + i);
                break;
            }

            list.remove(Integer.valueOf(x - i));
            list.remove(Integer.valueOf(x + i));
            if (x + i == Integer.MAX_VALUE || x - i == Integer.MIN_VALUE) {
                break;
            }

            i++;
        }
    } main {
        int x = readInt();
        int n = readInt();
        ArrayList<Integer> list = new ArrayList<>(n);
        for (int i = 0; i < n; i++) {
            list.add(readInt());
        }

        int i = 0;
        while (true) {
            if (!list.contains(x - i)) {
                System.out.print(x - i);
                break;
            }

            if (!list.contains(x + i)) {
                System.out.print(x + i);
                break;
            }

            list.remove(Integer.valueOf(x - i));
            list.remove(Integer.valueOf(x + i));
            if (x + i == Integer.MAX_VALUE || x - i == Integer.MIN_VALUE) {
                break;
            }

            i++;
        }
    } int x = readInt(); x readInt() readInt int n = readInt(); n readInt() readInt ArrayList<Integer> list = new ArrayList<>(n); list new ArrayList<>(n) for (int i = 0; i < n; i++) {
            list.add(readInt());
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            list.add(readInt());
        } {
            list.add(readInt());
        } list.add(readInt()) list.add list readInt() readInt int i = 0; i 0 while (true) {
            if (!list.contains(x - i)) {
                System.out.print(x - i);
                break;
            }

            if (!list.contains(x + i)) {
                System.out.print(x + i);
                break;
            }

            list.remove(Integer.valueOf(x - i));
            list.remove(Integer.valueOf(x + i));
            if (x + i == Integer.MAX_VALUE || x - i == Integer.MIN_VALUE) {
                break;
            }

            i++;
        } true {
            if (!list.contains(x - i)) {
                System.out.print(x - i);
                break;
            }

            if (!list.contains(x + i)) {
                System.out.print(x + i);
                break;
            }

            list.remove(Integer.valueOf(x - i));
            list.remove(Integer.valueOf(x + i));
            if (x + i == Integer.MAX_VALUE || x - i == Integer.MIN_VALUE) {
                break;
            }

            i++;
        } if (!list.contains(x - i)) {
                System.out.print(x - i);
                break;
            } !list.contains(x - i) list.contains(x - i) list.contains list x - i x i {
                System.out.print(x - i);
                break;
            } System.out.print(x - i) System.out.print System.out System System.out x - i x i break; if (!list.contains(x + i)) {
                System.out.print(x + i);
                break;
            } !list.contains(x + i) list.contains(x + i) list.contains list x + i x i {
                System.out.print(x + i);
                break;
            } System.out.print(x + i) System.out.print System.out System System.out x + i x i break; list.remove(Integer.valueOf(x - i)) list.remove list Integer.valueOf(x - i) Integer.valueOf Integer x - i x i list.remove(Integer.valueOf(x + i)) list.remove list Integer.valueOf(x + i) Integer.valueOf Integer x + i x i if (x + i == Integer.MAX_VALUE || x - i == Integer.MIN_VALUE) {
                break;
            } x + i == Integer.MAX_VALUE || x - i == Integer.MIN_VALUE x + i == Integer.MAX_VALUE x + i x i Integer.MAX_VALUE Integer Integer.MAX_VALUE x - i == Integer.MIN_VALUE x - i x i Integer.MIN_VALUE Integer Integer.MIN_VALUE {
                break;
            } break; i++ i String[] args args private static void read() {
        builder.setLength(0);
        while (true) {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) {
                    break;
                } else {
                    builder.appendCodePoint(b);
                }
            } catch (IOException e) {
                break;
            }
        }
    } read {
        builder.setLength(0);
        while (true) {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) {
                    break;
                } else {
                    builder.appendCodePoint(b);
                }
            } catch (IOException e) {
                break;
            }
        }
    } builder.setLength(0) builder.setLength builder 0 while (true) {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) {
                    break;
                } else {
                    builder.appendCodePoint(b);
                }
            } catch (IOException e) {
                break;
            }
        } true {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) {
                    break;
                } else {
                    builder.appendCodePoint(b);
                }
            } catch (IOException e) {
                break;
            }
        } try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) {
                    break;
                } else {
                    builder.appendCodePoint(b);
                }
            } catch (IOException e) {
                break;
            } catch (IOException e) {
                break;
            } IOException e {
                break;
            } break; {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) {
                    break;
                } else {
                    builder.appendCodePoint(b);
                }
            } int b = System.in.read(); b System.in.read() System.in.read System.in System System.in if (b == ' ' || b == '\n' || b == -1) {
                    break;
                } else {
                    builder.appendCodePoint(b);
                } b == ' ' || b == '\n' || b == -1 b == ' ' || b == '\n' || b == -1 b == ' ' b ' ' b == '\n' b '\n' b == -1 b -1 1 {
                    break;
                } break; {
                    builder.appendCodePoint(b);
                } builder.appendCodePoint(b) builder.appendCodePoint builder b private static int readInt() {
        read();
        return Integer.parseInt(builder.toString());
    } readInt {
        read();
        return Integer.parseInt(builder.toString());
    } read() read return Integer.parseInt(builder.toString()); Integer.parseInt(builder.toString()) Integer.parseInt Integer builder.toString() builder.toString builder private static int readInt(int radix) {
        read();
        return Integer.parseInt(builder.toString(), radix);
    } readInt {
        read();
        return Integer.parseInt(builder.toString(), radix);
    } read() read return Integer.parseInt(builder.toString(), radix); Integer.parseInt(builder.toString(), radix) Integer.parseInt Integer builder.toString() builder.toString builder radix int radix radix private static long readLong() {
        read();
        return Long.parseLong(builder.toString());
    } readLong {
        read();
        return Long.parseLong(builder.toString());
    } read() read return Long.parseLong(builder.toString()); Long.parseLong(builder.toString()) Long.parseLong Long builder.toString() builder.toString builder private static long readLong(int radix) {
        read();
        return Long.parseLong(builder.toString(), radix);
    } readLong {
        read();
        return Long.parseLong(builder.toString(), radix);
    } read() read return Long.parseLong(builder.toString(), radix); Long.parseLong(builder.toString(), radix) Long.parseLong Long builder.toString() builder.toString builder radix int radix radix private static BigInteger readBigInteger() {
        read();
        return new BigInteger(builder.toString());
    } readBigInteger {
        read();
        return new BigInteger(builder.toString());
    } read() read return new BigInteger(builder.toString()); new BigInteger(builder.toString()) private static BigInteger readBigInteger(int radix) {
        read();
        return new BigInteger(builder.toString(), radix);
    } readBigInteger {
        read();
        return new BigInteger(builder.toString(), radix);
    } read() read return new BigInteger(builder.toString(), radix); new BigInteger(builder.toString(), radix) int radix radix private static void skipLine() {
        while (true) {
            try {
                int b = System.in.read();
                if (b == '\n' || b == -1) {
                    break;
                }
            } catch (IOException e) {
                break;
            }
        }
    } skipLine {
        while (true) {
            try {
                int b = System.in.read();
                if (b == '\n' || b == -1) {
                    break;
                }
            } catch (IOException e) {
                break;
            }
        }
    } while (true) {
            try {
                int b = System.in.read();
                if (b == '\n' || b == -1) {
                    break;
                }
            } catch (IOException e) {
                break;
            }
        } true {
            try {
                int b = System.in.read();
                if (b == '\n' || b == -1) {
                    break;
                }
            } catch (IOException e) {
                break;
            }
        } try {
                int b = System.in.read();
                if (b == '\n' || b == -1) {
                    break;
                }
            } catch (IOException e) {
                break;
            } catch (IOException e) {
                break;
            } IOException e {
                break;
            } break; {
                int b = System.in.read();
                if (b == '\n' || b == -1) {
                    break;
                }
            } int b = System.in.read(); b System.in.read() System.in.read System.in System System.in if (b == '\n' || b == -1) {
                    break;
                } b == '\n' || b == -1 b == '\n' b '\n' b == -1 b -1 1 {
                    break;
                } break; private static void skip() {
        while (true) {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) break;
            } catch (IOException e) {
                break;
            }
        }
    } skip {
        while (true) {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) break;
            } catch (IOException e) {
                break;
            }
        }
    } while (true) {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) break;
            } catch (IOException e) {
                break;
            }
        } true {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) break;
            } catch (IOException e) {
                break;
            }
        } try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) break;
            } catch (IOException e) {
                break;
            } catch (IOException e) {
                break;
            } IOException e {
                break;
            } break; {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) break;
            } int b = System.in.read(); b System.in.read() System.in.read System.in System System.in if (b == ' ' || b == '\n' || b == -1) break; b == ' ' || b == '\n' || b == -1 b == ' ' || b == '\n' || b == -1 b == ' ' b ' ' b == '\n' b '\n' b == -1 b -1 1 break; public class Main {
    private static StringBuilder builder = new StringBuilder();
    public static void main(String[] args) {
        int x = readInt();
        int n = readInt();
        ArrayList<Integer> list = new ArrayList<>(n);
        for (int i = 0; i < n; i++) {
            list.add(readInt());
        }

        int i = 0;
        while (true) {
            if (!list.contains(x - i)) {
                System.out.print(x - i);
                break;
            }

            if (!list.contains(x + i)) {
                System.out.print(x + i);
                break;
            }

            list.remove(Integer.valueOf(x - i));
            list.remove(Integer.valueOf(x + i));
            if (x + i == Integer.MAX_VALUE || x - i == Integer.MIN_VALUE) {
                break;
            }

            i++;
        }
    }

    private static void read() {
        builder.setLength(0);
        while (true) {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) {
                    break;
                } else {
                    builder.appendCodePoint(b);
                }
            } catch (IOException e) {
                break;
            }
        }
    }

    private static int readInt() {
        read();
        return Integer.parseInt(builder.toString());
    }

    private static int readInt(int radix) {
        read();
        return Integer.parseInt(builder.toString(), radix);
    }

    private static long readLong() {
        read();
        return Long.parseLong(builder.toString());
    }

    private static long readLong(int radix) {
        read();
        return Long.parseLong(builder.toString(), radix);
    }

    private static BigInteger readBigInteger() {
        read();
        return new BigInteger(builder.toString());
    }

    private static BigInteger readBigInteger(int radix) {
        read();
        return new BigInteger(builder.toString(), radix);
    }

    private static void skipLine() {
        while (true) {
            try {
                int b = System.in.read();
                if (b == '\n' || b == -1) {
                    break;
                }
            } catch (IOException e) {
                break;
            }
        }
    }

    private static void skip() {
        while (true) {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) break;
            } catch (IOException e) {
                break;
            }
        }
    }

} public class Main {
    private static StringBuilder builder = new StringBuilder();
    public static void main(String[] args) {
        int x = readInt();
        int n = readInt();
        ArrayList<Integer> list = new ArrayList<>(n);
        for (int i = 0; i < n; i++) {
            list.add(readInt());
        }

        int i = 0;
        while (true) {
            if (!list.contains(x - i)) {
                System.out.print(x - i);
                break;
            }

            if (!list.contains(x + i)) {
                System.out.print(x + i);
                break;
            }

            list.remove(Integer.valueOf(x - i));
            list.remove(Integer.valueOf(x + i));
            if (x + i == Integer.MAX_VALUE || x - i == Integer.MIN_VALUE) {
                break;
            }

            i++;
        }
    }

    private static void read() {
        builder.setLength(0);
        while (true) {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) {
                    break;
                } else {
                    builder.appendCodePoint(b);
                }
            } catch (IOException e) {
                break;
            }
        }
    }

    private static int readInt() {
        read();
        return Integer.parseInt(builder.toString());
    }

    private static int readInt(int radix) {
        read();
        return Integer.parseInt(builder.toString(), radix);
    }

    private static long readLong() {
        read();
        return Long.parseLong(builder.toString());
    }

    private static long readLong(int radix) {
        read();
        return Long.parseLong(builder.toString(), radix);
    }

    private static BigInteger readBigInteger() {
        read();
        return new BigInteger(builder.toString());
    }

    private static BigInteger readBigInteger(int radix) {
        read();
        return new BigInteger(builder.toString(), radix);
    }

    private static void skipLine() {
        while (true) {
            try {
                int b = System.in.read();
                if (b == '\n' || b == -1) {
                    break;
                }
            } catch (IOException e) {
                break;
            }
        }
    }

    private static void skip() {
        while (true) {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) break;
            } catch (IOException e) {
                break;
            }
        }
    }

} Main
import java.io.IOException;
import java.math.BigInteger;
import java.util.ArrayList;

public class Main {
    private static StringBuilder builder = new StringBuilder();
    public static void main(String[] args) {
        int x = readInt();
        int n = readInt();
        ArrayList<Integer> list = new ArrayList<>(n);
        for (int i = 0; i < n; i++) {
            list.add(readInt());
        }

        int i = 0;
        while (true) {
            if (!list.contains(x - i)) {
                System.out.print(x - i);
                break;
            }

            if (!list.contains(x + i)) {
                System.out.print(x + i);
                break;
            }

            list.remove(Integer.valueOf(x - i));
            list.remove(Integer.valueOf(x + i));
            if (x + i == Integer.MAX_VALUE || x - i == Integer.MIN_VALUE) {
                break;
            }

            i++;
        }
    }

    private static void read() {
        builder.setLength(0);
        while (true) {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) {
                    break;
                } else {
                    builder.appendCodePoint(b);
                }
            } catch (IOException e) {
                break;
            }
        }
    }

    private static int readInt() {
        read();
        return Integer.parseInt(builder.toString());
    }

    private static int readInt(int radix) {
        read();
        return Integer.parseInt(builder.toString(), radix);
    }

    private static long readLong() {
        read();
        return Long.parseLong(builder.toString());
    }

    private static long readLong(int radix) {
        read();
        return Long.parseLong(builder.toString(), radix);
    }

    private static BigInteger readBigInteger() {
        read();
        return new BigInteger(builder.toString());
    }

    private static BigInteger readBigInteger(int radix) {
        read();
        return new BigInteger(builder.toString(), radix);
    }

    private static void skipLine() {
        while (true) {
            try {
                int b = System.in.read();
                if (b == '\n' || b == -1) {
                    break;
                }
            } catch (IOException e) {
                break;
            }
        }
    }

    private static void skip() {
        while (true) {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) break;
            } catch (IOException e) {
                break;
            }
        }
    }

}
