import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int X = scanner.nextInt();
        int N = scanner.nextInt();

        if (N == 0) {
            System.out.println(X);
            System.exit(0);
        }

        int[] p;
        p = new int [N];

        for (int i = 0; i < N; i++) {
            p[i] = scanner.nextInt();
        }

        List<Integer> list = new ArrayList<>(p.length);
        for (int i = 0; i < p.length; i++) {
            list.add(p[i]);
        }

        int ans = 0;

        for (int i = 1; i < X+1; i++) {
            for (int j = -1; j < 2; j++) {
                ans  = X + j * i;
                if (Collections.frequency(list,ans) == 0) {
                    System.out.println(ans);
                    System.exit(0);
                }
            }
        }
    }
} import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int X = scanner.nextInt();
        int N = scanner.nextInt();

        if (N == 0) {
            System.out.println(X);
            System.exit(0);
        }

        int[] p;
        p = new int [N];

        for (int i = 0; i < N; i++) {
            p[i] = scanner.nextInt();
        }

        List<Integer> list = new ArrayList<>(p.length);
        for (int i = 0; i < p.length; i++) {
            list.add(p[i]);
        }

        int ans = 0;

        for (int i = 1; i < X+1; i++) {
            for (int j = -1; j < 2; j++) {
                ans  = X + j * i;
                if (Collections.frequency(list,ans) == 0) {
                    System.out.println(ans);
                    System.exit(0);
                }
            }
        }
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int X = scanner.nextInt();
        int N = scanner.nextInt();

        if (N == 0) {
            System.out.println(X);
            System.exit(0);
        }

        int[] p;
        p = new int [N];

        for (int i = 0; i < N; i++) {
            p[i] = scanner.nextInt();
        }

        List<Integer> list = new ArrayList<>(p.length);
        for (int i = 0; i < p.length; i++) {
            list.add(p[i]);
        }

        int ans = 0;

        for (int i = 1; i < X+1; i++) {
            for (int j = -1; j < 2; j++) {
                ans  = X + j * i;
                if (Collections.frequency(list,ans) == 0) {
                    System.out.println(ans);
                    System.exit(0);
                }
            }
        }
    } main {
        Scanner scanner = new Scanner(System.in);
        int X = scanner.nextInt();
        int N = scanner.nextInt();

        if (N == 0) {
            System.out.println(X);
            System.exit(0);
        }

        int[] p;
        p = new int [N];

        for (int i = 0; i < N; i++) {
            p[i] = scanner.nextInt();
        }

        List<Integer> list = new ArrayList<>(p.length);
        for (int i = 0; i < p.length; i++) {
            list.add(p[i]);
        }

        int ans = 0;

        for (int i = 1; i < X+1; i++) {
            for (int j = -1; j < 2; j++) {
                ans  = X + j * i;
                if (Collections.frequency(list,ans) == 0) {
                    System.out.println(ans);
                    System.exit(0);
                }
            }
        }
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int X = scanner.nextInt(); X scanner.nextInt() scanner.nextInt scanner int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner if (N == 0) {
            System.out.println(X);
            System.exit(0);
        } N == 0 N 0 {
            System.out.println(X);
            System.exit(0);
        } System.out.println(X) System.out.println System.out System System.out X System.exit(0) System.exit System 0 int[] p; p p = new int [N] p new int [N] N for (int i = 0; i < N; i++) {
            p[i] = scanner.nextInt();
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            p[i] = scanner.nextInt();
        } {
            p[i] = scanner.nextInt();
        } p[i] = scanner.nextInt() p[i] p i scanner.nextInt() scanner.nextInt scanner List<Integer> list = new ArrayList<>(p.length); list new ArrayList<>(p.length) for (int i = 0; i < p.length; i++) {
            list.add(p[i]);
        } int i = 0; int i = 0; i 0 i < p.length i p.length p p.length i++ i++ i {
            list.add(p[i]);
        } {
            list.add(p[i]);
        } list.add(p[i]) list.add list p[i] p i int ans = 0; ans 0 for (int i = 1; i < X+1; i++) {
            for (int j = -1; j < 2; j++) {
                ans  = X + j * i;
                if (Collections.frequency(list,ans) == 0) {
                    System.out.println(ans);
                    System.exit(0);
                }
            }
        } int i = 1; int i = 1; i 1 i < X+1 i X+1 X 1 i++ i++ i {
            for (int j = -1; j < 2; j++) {
                ans  = X + j * i;
                if (Collections.frequency(list,ans) == 0) {
                    System.out.println(ans);
                    System.exit(0);
                }
            }
        } {
            for (int j = -1; j < 2; j++) {
                ans  = X + j * i;
                if (Collections.frequency(list,ans) == 0) {
                    System.out.println(ans);
                    System.exit(0);
                }
            }
        } for (int j = -1; j < 2; j++) {
                ans  = X + j * i;
                if (Collections.frequency(list,ans) == 0) {
                    System.out.println(ans);
                    System.exit(0);
                }
            } int j = -1; int j = -1; j -1 1 j < 2 j 2 j++ j++ j {
                ans  = X + j * i;
                if (Collections.frequency(list,ans) == 0) {
                    System.out.println(ans);
                    System.exit(0);
                }
            } {
                ans  = X + j * i;
                if (Collections.frequency(list,ans) == 0) {
                    System.out.println(ans);
                    System.exit(0);
                }
            } ans  = X + j * i ans X + j * i X j * i j i if (Collections.frequency(list,ans) == 0) {
                    System.out.println(ans);
                    System.exit(0);
                } Collections.frequency(list,ans) == 0 Collections.frequency(list,ans) Collections.frequency Collections list ans 0 {
                    System.out.println(ans);
                    System.exit(0);
                } System.out.println(ans) System.out.println System.out System System.out ans System.exit(0) System.exit System 0 String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int X = scanner.nextInt();
        int N = scanner.nextInt();

        if (N == 0) {
            System.out.println(X);
            System.exit(0);
        }

        int[] p;
        p = new int [N];

        for (int i = 0; i < N; i++) {
            p[i] = scanner.nextInt();
        }

        List<Integer> list = new ArrayList<>(p.length);
        for (int i = 0; i < p.length; i++) {
            list.add(p[i]);
        }

        int ans = 0;

        for (int i = 1; i < X+1; i++) {
            for (int j = -1; j < 2; j++) {
                ans  = X + j * i;
                if (Collections.frequency(list,ans) == 0) {
                    System.out.println(ans);
                    System.exit(0);
                }
            }
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int X = scanner.nextInt();
        int N = scanner.nextInt();

        if (N == 0) {
            System.out.println(X);
            System.exit(0);
        }

        int[] p;
        p = new int [N];

        for (int i = 0; i < N; i++) {
            p[i] = scanner.nextInt();
        }

        List<Integer> list = new ArrayList<>(p.length);
        for (int i = 0; i < p.length; i++) {
            list.add(p[i]);
        }

        int ans = 0;

        for (int i = 1; i < X+1; i++) {
            for (int j = -1; j < 2; j++) {
                ans  = X + j * i;
                if (Collections.frequency(list,ans) == 0) {
                    System.out.println(ans);
                    System.exit(0);
                }
            }
        }
    }
} Main
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int X = scanner.nextInt();
        int N = scanner.nextInt();

        if (N == 0) {
            System.out.println(X);
            System.exit(0);
        }

        int[] p;
        p = new int [N];

        for (int i = 0; i < N; i++) {
            p[i] = scanner.nextInt();
        }

        List<Integer> list = new ArrayList<>(p.length);
        for (int i = 0; i < p.length; i++) {
            list.add(p[i]);
        }

        int ans = 0;

        for (int i = 1; i < X+1; i++) {
            for (int j = -1; j < 2; j++) {
                ans  = X + j * i;
                if (Collections.frequency(list,ans) == 0) {
                    System.out.println(ans);
                    System.exit(0);
                }
            }
        }
    }
}
