import java.util.Scanner;
import java.util.TreeSet;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        TreeSet<Integer> p = new TreeSet<>();
        for (int i = 0; i < n; i++) {
            p.add(sc.nextInt());
        }
        int[] arr = new int[102];
        for (int i : p) {
            arr[i] = 1;
        }
        int min = Integer.MAX_VALUE;
        int ans = 0;
        for (int i = 0; i < arr.length; i++) {
            if(arr[i] == 0) {
                if(min > Math.abs(x - i)) {
                    min = x - i;
                    ans = i;
                }
            }
        }
        System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util import java.util.TreeSet; TreeSet 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();
        TreeSet<Integer> p = new TreeSet<>();
        for (int i = 0; i < n; i++) {
            p.add(sc.nextInt());
        }
        int[] arr = new int[102];
        for (int i : p) {
            arr[i] = 1;
        }
        int min = Integer.MAX_VALUE;
        int ans = 0;
        for (int i = 0; i < arr.length; i++) {
            if(arr[i] == 0) {
                if(min > Math.abs(x - i)) {
                    min = x - i;
                    ans = i;
                }
            }
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        TreeSet<Integer> p = new TreeSet<>();
        for (int i = 0; i < n; i++) {
            p.add(sc.nextInt());
        }
        int[] arr = new int[102];
        for (int i : p) {
            arr[i] = 1;
        }
        int min = Integer.MAX_VALUE;
        int ans = 0;
        for (int i = 0; i < arr.length; i++) {
            if(arr[i] == 0) {
                if(min > Math.abs(x - i)) {
                    min = x - i;
                    ans = i;
                }
            }
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        TreeSet<Integer> p = new TreeSet<>();
        for (int i = 0; i < n; i++) {
            p.add(sc.nextInt());
        }
        int[] arr = new int[102];
        for (int i : p) {
            arr[i] = 1;
        }
        int min = Integer.MAX_VALUE;
        int ans = 0;
        for (int i = 0; i < arr.length; i++) {
            if(arr[i] == 0) {
                if(min > Math.abs(x - i)) {
                    min = x - i;
                    ans = i;
                }
            }
        }
        System.out.println(ans);
    } 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 TreeSet<Integer> p = new TreeSet<>(); p new TreeSet<>() for (int i = 0; i < n; i++) {
            p.add(sc.nextInt());
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            p.add(sc.nextInt());
        } {
            p.add(sc.nextInt());
        } p.add(sc.nextInt()) p.add p sc.nextInt() sc.nextInt sc int[] arr = new int[102]; arr new int[102] 102 for (int i : p) {
            arr[i] = 1;
        } int i p {
            arr[i] = 1;
        } {
            arr[i] = 1;
        } arr[i] = 1 arr[i] arr i 1 int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE int ans = 0; ans 0 for (int i = 0; i < arr.length; i++) {
            if(arr[i] == 0) {
                if(min > Math.abs(x - i)) {
                    min = x - i;
                    ans = i;
                }
            }
        } int i = 0; int i = 0; i 0 i < arr.length i arr.length arr arr.length i++ i++ i {
            if(arr[i] == 0) {
                if(min > Math.abs(x - i)) {
                    min = x - i;
                    ans = i;
                }
            }
        } {
            if(arr[i] == 0) {
                if(min > Math.abs(x - i)) {
                    min = x - i;
                    ans = i;
                }
            }
        } if(arr[i] == 0) {
                if(min > Math.abs(x - i)) {
                    min = x - i;
                    ans = i;
                }
            } arr[i] == 0 arr[i] arr i 0 {
                if(min > Math.abs(x - i)) {
                    min = x - i;
                    ans = i;
                }
            } if(min > Math.abs(x - i)) {
                    min = x - i;
                    ans = i;
                } min > Math.abs(x - i) min Math.abs(x - i) Math.abs Math x - i x i {
                    min = x - i;
                    ans = i;
                } min = x - i min x - i x i ans = i ans i System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        TreeSet<Integer> p = new TreeSet<>();
        for (int i = 0; i < n; i++) {
            p.add(sc.nextInt());
        }
        int[] arr = new int[102];
        for (int i : p) {
            arr[i] = 1;
        }
        int min = Integer.MAX_VALUE;
        int ans = 0;
        for (int i = 0; i < arr.length; i++) {
            if(arr[i] == 0) {
                if(min > Math.abs(x - i)) {
                    min = x - i;
                    ans = i;
                }
            }
        }
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        TreeSet<Integer> p = new TreeSet<>();
        for (int i = 0; i < n; i++) {
            p.add(sc.nextInt());
        }
        int[] arr = new int[102];
        for (int i : p) {
            arr[i] = 1;
        }
        int min = Integer.MAX_VALUE;
        int ans = 0;
        for (int i = 0; i < arr.length; i++) {
            if(arr[i] == 0) {
                if(min > Math.abs(x - i)) {
                    min = x - i;
                    ans = i;
                }
            }
        }
        System.out.println(ans);
    }
} Main
import java.util.Scanner;
import java.util.TreeSet;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        TreeSet<Integer> p = new TreeSet<>();
        for (int i = 0; i < n; i++) {
            p.add(sc.nextInt());
        }
        int[] arr = new int[102];
        for (int i : p) {
            arr[i] = 1;
        }
        int min = Integer.MAX_VALUE;
        int ans = 0;
        for (int i = 0; i < arr.length; i++) {
            if(arr[i] == 0) {
                if(min > Math.abs(x - i)) {
                    min = x - i;
                    ans = i;
                }
            }
        }
        System.out.println(ans);
    }
}