
import java.io.*;
import java.util.*;

/**
 * @author Tran Anh Tai
 * @template for CP codes
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }
    // main solver
    static class Task{
        public void solve(InputReader in, PrintWriter out) {
            int x = in.nextInt();
            int n = in.nextInt();
            int p[] = new int[n];
            boolean[] visited = new boolean[101];
            for (int i = 0; i < n; i++){
                int num = in.nextInt();
                visited[num] = true;
            }
            int more = 101, less = 0;
            for (int i = x; i >= 0; i--){
                if (!visited[i]){
                    less = i;
                    break;
                }
            }
            for (int i = x + 1; i <= 100; i++){
                if (!visited[i]){
                    more = i;
                    break;
                }
            }
            if  (more - x < x - less){
                out.println(more);
            }
            else{
                out.println(less);
            }
        }
    }
    // fast input reader class;
    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream));
        }

        public String nextToken() {
            while (st == null || !st.hasMoreTokens()) {
                String line = null;
                try {
                    line = br.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
                if (line == null) {
                    return null;
                }
                st = new StringTokenizer(line);
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }
        public long nextLong(){
            return Long.parseLong(nextToken());
        }
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }
    // main solver
    static class Task{
        public void solve(InputReader in, PrintWriter out) {
            int x = in.nextInt();
            int n = in.nextInt();
            int p[] = new int[n];
            boolean[] visited = new boolean[101];
            for (int i = 0; i < n; i++){
                int num = in.nextInt();
                visited[num] = true;
            }
            int more = 101, less = 0;
            for (int i = x; i >= 0; i--){
                if (!visited[i]){
                    less = i;
                    break;
                }
            }
            for (int i = x + 1; i <= 100; i++){
                if (!visited[i]){
                    more = i;
                    break;
                }
            }
            if  (more - x < x - less){
                out.println(more);
            }
            else{
                out.println(less);
            }
        }
    }
    // fast input reader class;
    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream));
        }

        public String nextToken() {
            while (st == null || !st.hasMoreTokens()) {
                String line = null;
                try {
                    line = br.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
                if (line == null) {
                    return null;
                }
                st = new StringTokenizer(line);
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }
        public long nextLong(){
            return Long.parseLong(nextToken());
        }
    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out InputReader in = new InputReader(inputStream); in new InputReader(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) Task solver = new Task(); solver new Task() solver.solve(in, out) solver.solve solver in out out.close() out.close out String[] args args static class Task{
        public void solve(InputReader in, PrintWriter out) {
            int x = in.nextInt();
            int n = in.nextInt();
            int p[] = new int[n];
            boolean[] visited = new boolean[101];
            for (int i = 0; i < n; i++){
                int num = in.nextInt();
                visited[num] = true;
            }
            int more = 101, less = 0;
            for (int i = x; i >= 0; i--){
                if (!visited[i]){
                    less = i;
                    break;
                }
            }
            for (int i = x + 1; i <= 100; i++){
                if (!visited[i]){
                    more = i;
                    break;
                }
            }
            if  (more - x < x - less){
                out.println(more);
            }
            else{
                out.println(less);
            }
        }
    } Task public void solve(InputReader in, PrintWriter out) {
            int x = in.nextInt();
            int n = in.nextInt();
            int p[] = new int[n];
            boolean[] visited = new boolean[101];
            for (int i = 0; i < n; i++){
                int num = in.nextInt();
                visited[num] = true;
            }
            int more = 101, less = 0;
            for (int i = x; i >= 0; i--){
                if (!visited[i]){
                    less = i;
                    break;
                }
            }
            for (int i = x + 1; i <= 100; i++){
                if (!visited[i]){
                    more = i;
                    break;
                }
            }
            if  (more - x < x - less){
                out.println(more);
            }
            else{
                out.println(less);
            }
        } solve {
            int x = in.nextInt();
            int n = in.nextInt();
            int p[] = new int[n];
            boolean[] visited = new boolean[101];
            for (int i = 0; i < n; i++){
                int num = in.nextInt();
                visited[num] = true;
            }
            int more = 101, less = 0;
            for (int i = x; i >= 0; i--){
                if (!visited[i]){
                    less = i;
                    break;
                }
            }
            for (int i = x + 1; i <= 100; i++){
                if (!visited[i]){
                    more = i;
                    break;
                }
            }
            if  (more - x < x - less){
                out.println(more);
            }
            else{
                out.println(less);
            }
        } int x = in.nextInt(); x in.nextInt() in.nextInt in int n = in.nextInt(); n in.nextInt() in.nextInt in int p[] = new int[n]; p new int[n] n boolean[] visited = new boolean[101]; visited new boolean[101] 101 for (int i = 0; i < n; i++){
                int num = in.nextInt();
                visited[num] = true;
            } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
                int num = in.nextInt();
                visited[num] = true;
            } {
                int num = in.nextInt();
                visited[num] = true;
            } int num = in.nextInt(); num in.nextInt() in.nextInt in visited[num] = true visited[num] visited num true int more = 101 more 101 less = 0; less 0 for (int i = x; i >= 0; i--){
                if (!visited[i]){
                    less = i;
                    break;
                }
            } int i = x; int i = x; i x i >= 0 i 0 i-- i-- i {
                if (!visited[i]){
                    less = i;
                    break;
                }
            } {
                if (!visited[i]){
                    less = i;
                    break;
                }
            } if (!visited[i]){
                    less = i;
                    break;
                } !visited[i] visited[i] visited i {
                    less = i;
                    break;
                } less = i less i break; for (int i = x + 1; i <= 100; i++){
                if (!visited[i]){
                    more = i;
                    break;
                }
            } int i = x + 1; int i = x + 1; i x + 1 x 1 i <= 100 i 100 i++ i++ i {
                if (!visited[i]){
                    more = i;
                    break;
                }
            } {
                if (!visited[i]){
                    more = i;
                    break;
                }
            } if (!visited[i]){
                    more = i;
                    break;
                } !visited[i] visited[i] visited i {
                    more = i;
                    break;
                } more = i more i break; if  (more - x < x - less){
                out.println(more);
            }
            else{
                out.println(less);
            } more - x < x - less more - x more x x - less x less {
                out.println(more);
            } out.println(more) out.println out more {
                out.println(less);
            } out.println(less) out.println out less InputReader in in PrintWriter out out static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream));
        }

        public String nextToken() {
            while (st == null || !st.hasMoreTokens()) {
                String line = null;
                try {
                    line = br.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
                if (line == null) {
                    return null;
                }
                st = new StringTokenizer(line);
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }
        public long nextLong(){
            return Long.parseLong(nextToken());
        }
    } InputReader BufferedReader br; br StringTokenizer st; st public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream));
        } InputReader {
            br = new BufferedReader(new InputStreamReader(stream));
        } br = new BufferedReader(new InputStreamReader(stream)) br new BufferedReader(new InputStreamReader(stream)) InputStream stream stream public String nextToken() {
            while (st == null || !st.hasMoreTokens()) {
                String line = null;
                try {
                    line = br.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
                if (line == null) {
                    return null;
                }
                st = new StringTokenizer(line);
            }
            return st.nextToken();
        } nextToken {
            while (st == null || !st.hasMoreTokens()) {
                String line = null;
                try {
                    line = br.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
                if (line == null) {
                    return null;
                }
                st = new StringTokenizer(line);
            }
            return st.nextToken();
        } while (st == null || !st.hasMoreTokens()) {
                String line = null;
                try {
                    line = br.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
                if (line == null) {
                    return null;
                }
                st = new StringTokenizer(line);
            } st == null || !st.hasMoreTokens() st == null st null !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st {
                String line = null;
                try {
                    line = br.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
                if (line == null) {
                    return null;
                }
                st = new StringTokenizer(line);
            } String line = null; line null try {
                    line = br.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                } IOException e {
                    throw new RuntimeException(e);
                } throw new RuntimeException(e); new RuntimeException(e) {
                    line = br.readLine();
                } line = br.readLine() line br.readLine() br.readLine br if (line == null) {
                    return null;
                } line == null line null {
                    return null;
                } return null; null st = new StringTokenizer(line) st new StringTokenizer(line) return st.nextToken(); st.nextToken() st.nextToken st public int nextInt() {
            return Integer.parseInt(nextToken());
        } nextInt {
            return Integer.parseInt(nextToken());
        } return Integer.parseInt(nextToken()); Integer.parseInt(nextToken()) Integer.parseInt Integer nextToken() nextToken public long nextLong(){
            return Long.parseLong(nextToken());
        } nextLong {
            return Long.parseLong(nextToken());
        } return Long.parseLong(nextToken()); Long.parseLong(nextToken()) Long.parseLong Long nextToken() nextToken public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }
    // main solver
    static class Task{
        public void solve(InputReader in, PrintWriter out) {
            int x = in.nextInt();
            int n = in.nextInt();
            int p[] = new int[n];
            boolean[] visited = new boolean[101];
            for (int i = 0; i < n; i++){
                int num = in.nextInt();
                visited[num] = true;
            }
            int more = 101, less = 0;
            for (int i = x; i >= 0; i--){
                if (!visited[i]){
                    less = i;
                    break;
                }
            }
            for (int i = x + 1; i <= 100; i++){
                if (!visited[i]){
                    more = i;
                    break;
                }
            }
            if  (more - x < x - less){
                out.println(more);
            }
            else{
                out.println(less);
            }
        }
    }
    // fast input reader class;
    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream));
        }

        public String nextToken() {
            while (st == null || !st.hasMoreTokens()) {
                String line = null;
                try {
                    line = br.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
                if (line == null) {
                    return null;
                }
                st = new StringTokenizer(line);
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }
        public long nextLong(){
            return Long.parseLong(nextToken());
        }
    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }
    // main solver
    static class Task{
        public void solve(InputReader in, PrintWriter out) {
            int x = in.nextInt();
            int n = in.nextInt();
            int p[] = new int[n];
            boolean[] visited = new boolean[101];
            for (int i = 0; i < n; i++){
                int num = in.nextInt();
                visited[num] = true;
            }
            int more = 101, less = 0;
            for (int i = x; i >= 0; i--){
                if (!visited[i]){
                    less = i;
                    break;
                }
            }
            for (int i = x + 1; i <= 100; i++){
                if (!visited[i]){
                    more = i;
                    break;
                }
            }
            if  (more - x < x - less){
                out.println(more);
            }
            else{
                out.println(less);
            }
        }
    }
    // fast input reader class;
    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream));
        }

        public String nextToken() {
            while (st == null || !st.hasMoreTokens()) {
                String line = null;
                try {
                    line = br.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
                if (line == null) {
                    return null;
                }
                st = new StringTokenizer(line);
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }
        public long nextLong(){
            return Long.parseLong(nextToken());
        }
    }
} Main

import java.io.*;
import java.util.*;

/**
 * @author Tran Anh Tai
 * @template for CP codes
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }
    // main solver
    static class Task{
        public void solve(InputReader in, PrintWriter out) {
            int x = in.nextInt();
            int n = in.nextInt();
            int p[] = new int[n];
            boolean[] visited = new boolean[101];
            for (int i = 0; i < n; i++){
                int num = in.nextInt();
                visited[num] = true;
            }
            int more = 101, less = 0;
            for (int i = x; i >= 0; i--){
                if (!visited[i]){
                    less = i;
                    break;
                }
            }
            for (int i = x + 1; i <= 100; i++){
                if (!visited[i]){
                    more = i;
                    break;
                }
            }
            if  (more - x < x - less){
                out.println(more);
            }
            else{
                out.println(less);
            }
        }
    }
    // fast input reader class;
    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream));
        }

        public String nextToken() {
            while (st == null || !st.hasMoreTokens()) {
                String line = null;
                try {
                    line = br.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
                if (line == null) {
                    return null;
                }
                st = new StringTokenizer(line);
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }
        public long nextLong(){
            return Long.parseLong(nextToken());
        }
    }
}