import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(sc.nextInt());
        }
        if(x == 0) {
            System.out.println(x);
            return;
        }
        int min = Integer.MAX_VALUE;
        int ans1 = 0;
        for (int i = -101; i <= 101; i++) {
            if(!list.contains(i)) {
                if(min > Math.abs(i - x)) {
                    min = Math.abs(i - x);
                    ans1 = i;
                }
            }
        }
        int ans2 = 0;
        min = Integer.MAX_VALUE;
        for (int i = 101; i >= -101; i--) {
            if(!list.contains(i)) {
                if(min > Math.abs(i - x)) {
                    min = Math.abs(i - x);
                    ans2 = i;
                }
            }
        }
        System.out.println(Math.min(ans1, ans2));
    }
} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner 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();
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(sc.nextInt());
        }
        if(x == 0) {
            System.out.println(x);
            return;
        }
        int min = Integer.MAX_VALUE;
        int ans1 = 0;
        for (int i = -101; i <= 101; i++) {
            if(!list.contains(i)) {
                if(min > Math.abs(i - x)) {
                    min = Math.abs(i - x);
                    ans1 = i;
                }
            }
        }
        int ans2 = 0;
        min = Integer.MAX_VALUE;
        for (int i = 101; i >= -101; i--) {
            if(!list.contains(i)) {
                if(min > Math.abs(i - x)) {
                    min = Math.abs(i - x);
                    ans2 = i;
                }
            }
        }
        System.out.println(Math.min(ans1, ans2));
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(sc.nextInt());
        }
        if(x == 0) {
            System.out.println(x);
            return;
        }
        int min = Integer.MAX_VALUE;
        int ans1 = 0;
        for (int i = -101; i <= 101; i++) {
            if(!list.contains(i)) {
                if(min > Math.abs(i - x)) {
                    min = Math.abs(i - x);
                    ans1 = i;
                }
            }
        }
        int ans2 = 0;
        min = Integer.MAX_VALUE;
        for (int i = 101; i >= -101; i--) {
            if(!list.contains(i)) {
                if(min > Math.abs(i - x)) {
                    min = Math.abs(i - x);
                    ans2 = i;
                }
            }
        }
        System.out.println(Math.min(ans1, ans2));
    } main {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(sc.nextInt());
        }
        if(x == 0) {
            System.out.println(x);
            return;
        }
        int min = Integer.MAX_VALUE;
        int ans1 = 0;
        for (int i = -101; i <= 101; i++) {
            if(!list.contains(i)) {
                if(min > Math.abs(i - x)) {
                    min = Math.abs(i - x);
                    ans1 = i;
                }
            }
        }
        int ans2 = 0;
        min = Integer.MAX_VALUE;
        for (int i = 101; i >= -101; i--) {
            if(!list.contains(i)) {
                if(min > Math.abs(i - x)) {
                    min = Math.abs(i - x);
                    ans2 = i;
                }
            }
        }
        System.out.println(Math.min(ans1, ans2));
    } 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 ArrayList<Integer> list = new ArrayList<>(); list new ArrayList<>() for (int i = 0; i < n; i++) {
            list.add(sc.nextInt());
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            list.add(sc.nextInt());
        } {
            list.add(sc.nextInt());
        } list.add(sc.nextInt()) list.add list sc.nextInt() sc.nextInt sc if(x == 0) {
            System.out.println(x);
            return;
        } x == 0 x 0 {
            System.out.println(x);
            return;
        } System.out.println(x) System.out.println System.out System System.out x return; int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE int ans1 = 0; ans1 0 for (int i = -101; i <= 101; i++) {
            if(!list.contains(i)) {
                if(min > Math.abs(i - x)) {
                    min = Math.abs(i - x);
                    ans1 = i;
                }
            }
        } int i = -101; int i = -101; i -101 101 i <= 101 i 101 i++ i++ i {
            if(!list.contains(i)) {
                if(min > Math.abs(i - x)) {
                    min = Math.abs(i - x);
                    ans1 = i;
                }
            }
        } {
            if(!list.contains(i)) {
                if(min > Math.abs(i - x)) {
                    min = Math.abs(i - x);
                    ans1 = i;
                }
            }
        } if(!list.contains(i)) {
                if(min > Math.abs(i - x)) {
                    min = Math.abs(i - x);
                    ans1 = i;
                }
            } !list.contains(i) list.contains(i) list.contains list i {
                if(min > Math.abs(i - x)) {
                    min = Math.abs(i - x);
                    ans1 = i;
                }
            } if(min > Math.abs(i - x)) {
                    min = Math.abs(i - x);
                    ans1 = i;
                } min > Math.abs(i - x) min Math.abs(i - x) Math.abs Math i - x i x {
                    min = Math.abs(i - x);
                    ans1 = i;
                } min = Math.abs(i - x) min Math.abs(i - x) Math.abs Math i - x i x ans1 = i ans1 i int ans2 = 0; ans2 0 min = Integer.MAX_VALUE min Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int i = 101; i >= -101; i--) {
            if(!list.contains(i)) {
                if(min > Math.abs(i - x)) {
                    min = Math.abs(i - x);
                    ans2 = i;
                }
            }
        } int i = 101; int i = 101; i 101 i >= -101 i -101 101 i-- i-- i {
            if(!list.contains(i)) {
                if(min > Math.abs(i - x)) {
                    min = Math.abs(i - x);
                    ans2 = i;
                }
            }
        } {
            if(!list.contains(i)) {
                if(min > Math.abs(i - x)) {
                    min = Math.abs(i - x);
                    ans2 = i;
                }
            }
        } if(!list.contains(i)) {
                if(min > Math.abs(i - x)) {
                    min = Math.abs(i - x);
                    ans2 = i;
                }
            } !list.contains(i) list.contains(i) list.contains list i {
                if(min > Math.abs(i - x)) {
                    min = Math.abs(i - x);
                    ans2 = i;
                }
            } if(min > Math.abs(i - x)) {
                    min = Math.abs(i - x);
                    ans2 = i;
                } min > Math.abs(i - x) min Math.abs(i - x) Math.abs Math i - x i x {
                    min = Math.abs(i - x);
                    ans2 = i;
                } min = Math.abs(i - x) min Math.abs(i - x) Math.abs Math i - x i x ans2 = i ans2 i System.out.println(Math.min(ans1, ans2)) System.out.println System.out System System.out Math.min(ans1, ans2) Math.min Math ans1 ans2 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();
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(sc.nextInt());
        }
        if(x == 0) {
            System.out.println(x);
            return;
        }
        int min = Integer.MAX_VALUE;
        int ans1 = 0;
        for (int i = -101; i <= 101; i++) {
            if(!list.contains(i)) {
                if(min > Math.abs(i - x)) {
                    min = Math.abs(i - x);
                    ans1 = i;
                }
            }
        }
        int ans2 = 0;
        min = Integer.MAX_VALUE;
        for (int i = 101; i >= -101; i--) {
            if(!list.contains(i)) {
                if(min > Math.abs(i - x)) {
                    min = Math.abs(i - x);
                    ans2 = i;
                }
            }
        }
        System.out.println(Math.min(ans1, ans2));
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(sc.nextInt());
        }
        if(x == 0) {
            System.out.println(x);
            return;
        }
        int min = Integer.MAX_VALUE;
        int ans1 = 0;
        for (int i = -101; i <= 101; i++) {
            if(!list.contains(i)) {
                if(min > Math.abs(i - x)) {
                    min = Math.abs(i - x);
                    ans1 = i;
                }
            }
        }
        int ans2 = 0;
        min = Integer.MAX_VALUE;
        for (int i = 101; i >= -101; i--) {
            if(!list.contains(i)) {
                if(min > Math.abs(i - x)) {
                    min = Math.abs(i - x);
                    ans2 = i;
                }
            }
        }
        System.out.println(Math.min(ans1, ans2));
    }
} Main
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(sc.nextInt());
        }
        if(x == 0) {
            System.out.println(x);
            return;
        }
        int min = Integer.MAX_VALUE;
        int ans1 = 0;
        for (int i = -101; i <= 101; i++) {
            if(!list.contains(i)) {
                if(min > Math.abs(i - x)) {
                    min = Math.abs(i - x);
                    ans1 = i;
                }
            }
        }
        int ans2 = 0;
        min = Integer.MAX_VALUE;
        for (int i = 101; i >= -101; i--) {
            if(!list.contains(i)) {
                if(min > Math.abs(i - x)) {
                    min = Math.abs(i - x);
                    ans2 = i;
                }
            }
        }
        System.out.println(Math.min(ans1, ans2));
    }
}