import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        Integer[] p = new Integer[n];
        for (int i = 0; i < n; i++) {
            p[i] = sc.nextInt();
        }
        if (n == 0) {
            System.out.println(x);
            return;
        } else if (!checkForbiddenList(p, x)) {
            System.out.println(x);
            return;
        } else {
            int ans = 0;
            for (int i = 0; i < 100; i++) {
                if (!checkForbiddenList(p, x - i)) {
                    ans = x - i;
                    break;
                } else if (!checkForbiddenList(p, x + i)) {
                    ans = x + i;
                    break;
                }
            }
            System.out.println(ans);
            return;
        }
    }

    private static boolean checkForbiddenList(Integer[] p, int x) {
        return Arrays.asList(p).contains(x);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        Integer[] p = new Integer[n];
        for (int i = 0; i < n; i++) {
            p[i] = sc.nextInt();
        }
        if (n == 0) {
            System.out.println(x);
            return;
        } else if (!checkForbiddenList(p, x)) {
            System.out.println(x);
            return;
        } else {
            int ans = 0;
            for (int i = 0; i < 100; i++) {
                if (!checkForbiddenList(p, x - i)) {
                    ans = x - i;
                    break;
                } else if (!checkForbiddenList(p, x + i)) {
                    ans = x + i;
                    break;
                }
            }
            System.out.println(ans);
            return;
        }
    }

    private static boolean checkForbiddenList(Integer[] p, int x) {
        return Arrays.asList(p).contains(x);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        Integer[] p = new Integer[n];
        for (int i = 0; i < n; i++) {
            p[i] = sc.nextInt();
        }
        if (n == 0) {
            System.out.println(x);
            return;
        } else if (!checkForbiddenList(p, x)) {
            System.out.println(x);
            return;
        } else {
            int ans = 0;
            for (int i = 0; i < 100; i++) {
                if (!checkForbiddenList(p, x - i)) {
                    ans = x - i;
                    break;
                } else if (!checkForbiddenList(p, x + i)) {
                    ans = x + i;
                    break;
                }
            }
            System.out.println(ans);
            return;
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        Integer[] p = new Integer[n];
        for (int i = 0; i < n; i++) {
            p[i] = sc.nextInt();
        }
        if (n == 0) {
            System.out.println(x);
            return;
        } else if (!checkForbiddenList(p, x)) {
            System.out.println(x);
            return;
        } else {
            int ans = 0;
            for (int i = 0; i < 100; i++) {
                if (!checkForbiddenList(p, x - i)) {
                    ans = x - i;
                    break;
                } else if (!checkForbiddenList(p, x + i)) {
                    ans = x + i;
                    break;
                }
            }
            System.out.println(ans);
            return;
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc Integer[] p = new Integer[n]; p new Integer[n] n for (int i = 0; i < n; i++) {
            p[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            p[i] = sc.nextInt();
        } {
            p[i] = sc.nextInt();
        } p[i] = sc.nextInt() p[i] p i sc.nextInt() sc.nextInt sc if (n == 0) {
            System.out.println(x);
            return;
        } else if (!checkForbiddenList(p, x)) {
            System.out.println(x);
            return;
        } else {
            int ans = 0;
            for (int i = 0; i < 100; i++) {
                if (!checkForbiddenList(p, x - i)) {
                    ans = x - i;
                    break;
                } else if (!checkForbiddenList(p, x + i)) {
                    ans = x + i;
                    break;
                }
            }
            System.out.println(ans);
            return;
        } n == 0 n 0 {
            System.out.println(x);
            return;
        } System.out.println(x) System.out.println System.out System System.out x return; if (!checkForbiddenList(p, x)) {
            System.out.println(x);
            return;
        } else {
            int ans = 0;
            for (int i = 0; i < 100; i++) {
                if (!checkForbiddenList(p, x - i)) {
                    ans = x - i;
                    break;
                } else if (!checkForbiddenList(p, x + i)) {
                    ans = x + i;
                    break;
                }
            }
            System.out.println(ans);
            return;
        } !checkForbiddenList(p, x) checkForbiddenList(p, x) checkForbiddenList p x {
            System.out.println(x);
            return;
        } System.out.println(x) System.out.println System.out System System.out x return; {
            int ans = 0;
            for (int i = 0; i < 100; i++) {
                if (!checkForbiddenList(p, x - i)) {
                    ans = x - i;
                    break;
                } else if (!checkForbiddenList(p, x + i)) {
                    ans = x + i;
                    break;
                }
            }
            System.out.println(ans);
            return;
        } int ans = 0; ans 0 for (int i = 0; i < 100; i++) {
                if (!checkForbiddenList(p, x - i)) {
                    ans = x - i;
                    break;
                } else if (!checkForbiddenList(p, x + i)) {
                    ans = x + i;
                    break;
                }
            } int i = 0; int i = 0; i 0 i < 100 i 100 i++ i++ i {
                if (!checkForbiddenList(p, x - i)) {
                    ans = x - i;
                    break;
                } else if (!checkForbiddenList(p, x + i)) {
                    ans = x + i;
                    break;
                }
            } {
                if (!checkForbiddenList(p, x - i)) {
                    ans = x - i;
                    break;
                } else if (!checkForbiddenList(p, x + i)) {
                    ans = x + i;
                    break;
                }
            } if (!checkForbiddenList(p, x - i)) {
                    ans = x - i;
                    break;
                } else if (!checkForbiddenList(p, x + i)) {
                    ans = x + i;
                    break;
                } !checkForbiddenList(p, x - i) checkForbiddenList(p, x - i) checkForbiddenList p x - i x i {
                    ans = x - i;
                    break;
                } ans = x - i ans x - i x i break; if (!checkForbiddenList(p, x + i)) {
                    ans = x + i;
                    break;
                } !checkForbiddenList(p, x + i) checkForbiddenList(p, x + i) checkForbiddenList p x + i x i {
                    ans = x + i;
                    break;
                } ans = x + i ans x + i x i break; System.out.println(ans) System.out.println System.out System System.out ans return; String[] args args private static boolean checkForbiddenList(Integer[] p, int x) {
        return Arrays.asList(p).contains(x);
    } checkForbiddenList {
        return Arrays.asList(p).contains(x);
    } return Arrays.asList(p).contains(x); Arrays.asList(p).contains(x) Arrays.asList(p).contains Arrays.asList(p) Arrays.asList Arrays p x Integer[] p p int x x public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        Integer[] p = new Integer[n];
        for (int i = 0; i < n; i++) {
            p[i] = sc.nextInt();
        }
        if (n == 0) {
            System.out.println(x);
            return;
        } else if (!checkForbiddenList(p, x)) {
            System.out.println(x);
            return;
        } else {
            int ans = 0;
            for (int i = 0; i < 100; i++) {
                if (!checkForbiddenList(p, x - i)) {
                    ans = x - i;
                    break;
                } else if (!checkForbiddenList(p, x + i)) {
                    ans = x + i;
                    break;
                }
            }
            System.out.println(ans);
            return;
        }
    }

    private static boolean checkForbiddenList(Integer[] p, int x) {
        return Arrays.asList(p).contains(x);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        Integer[] p = new Integer[n];
        for (int i = 0; i < n; i++) {
            p[i] = sc.nextInt();
        }
        if (n == 0) {
            System.out.println(x);
            return;
        } else if (!checkForbiddenList(p, x)) {
            System.out.println(x);
            return;
        } else {
            int ans = 0;
            for (int i = 0; i < 100; i++) {
                if (!checkForbiddenList(p, x - i)) {
                    ans = x - i;
                    break;
                } else if (!checkForbiddenList(p, x + i)) {
                    ans = x + i;
                    break;
                }
            }
            System.out.println(ans);
            return;
        }
    }

    private static boolean checkForbiddenList(Integer[] p, int x) {
        return Arrays.asList(p).contains(x);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        Integer[] p = new Integer[n];
        for (int i = 0; i < n; i++) {
            p[i] = sc.nextInt();
        }
        if (n == 0) {
            System.out.println(x);
            return;
        } else if (!checkForbiddenList(p, x)) {
            System.out.println(x);
            return;
        } else {
            int ans = 0;
            for (int i = 0; i < 100; i++) {
                if (!checkForbiddenList(p, x - i)) {
                    ans = x - i;
                    break;
                } else if (!checkForbiddenList(p, x + i)) {
                    ans = x + i;
                    break;
                }
            }
            System.out.println(ans);
            return;
        }
    }

    private static boolean checkForbiddenList(Integer[] p, int x) {
        return Arrays.asList(p).contains(x);
    }
}