import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }

    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int X = scan.nextInt();
        int N = scan.nextInt();
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < N; i++) {
            set.add(scan.nextInt());
        }
        int diff = Integer.MAX_VALUE;
        int ans = -1;
        for (int i = 0; i <= 101; i++) {
            if (set.contains(i)) {
                continue;
            }
            int t = Math.abs(i - X);
            if (t < diff) {
                ans = i;
                diff = t;
            }
        }
        System.out.println(ans);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.HashSet; HashSet java.util import java.util.Scanner; Scanner java.util import java.util.Set; Set java.util public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }

    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int X = scan.nextInt();
        int N = scan.nextInt();
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < N; i++) {
            set.add(scan.nextInt());
        }
        int diff = Integer.MAX_VALUE;
        int ans = -1;
        for (int i = 0; i <= 101; i++) {
            if (set.contains(i)) {
                continue;
            }
            int t = Math.abs(i - X);
            if (t < diff) {
                ans = i;
                diff = t;
            }
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    } main {
        Main main = new Main();
        main.solve();
    } Main main = new Main(); main new Main() main.solve() main.solve main String[] args args public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int X = scan.nextInt();
        int N = scan.nextInt();
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < N; i++) {
            set.add(scan.nextInt());
        }
        int diff = Integer.MAX_VALUE;
        int ans = -1;
        for (int i = 0; i <= 101; i++) {
            if (set.contains(i)) {
                continue;
            }
            int t = Math.abs(i - X);
            if (t < diff) {
                ans = i;
                diff = t;
            }
        }
        System.out.println(ans);
    } solve {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int X = scan.nextInt();
        int N = scan.nextInt();
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < N; i++) {
            set.add(scan.nextInt());
        }
        int diff = Integer.MAX_VALUE;
        int ans = -1;
        for (int i = 0; i <= 101; i++) {
            if (set.contains(i)) {
                continue;
            }
            int t = Math.abs(i - X);
            if (t < diff) {
                ans = i;
                diff = t;
            }
        }
        System.out.println(ans);
    } Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in))); scan new Scanner(new BufferedReader(new InputStreamReader(System.in))) int X = scan.nextInt(); X scan.nextInt() scan.nextInt scan int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan Set<Integer> set = new HashSet<>(); set new HashSet<>() for (int i = 0; i < N; i++) {
            set.add(scan.nextInt());
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            set.add(scan.nextInt());
        } {
            set.add(scan.nextInt());
        } set.add(scan.nextInt()) set.add set scan.nextInt() scan.nextInt scan int diff = Integer.MAX_VALUE; diff Integer.MAX_VALUE Integer Integer.MAX_VALUE int ans = -1; ans -1 1 for (int i = 0; i <= 101; i++) {
            if (set.contains(i)) {
                continue;
            }
            int t = Math.abs(i - X);
            if (t < diff) {
                ans = i;
                diff = t;
            }
        } int i = 0; int i = 0; i 0 i <= 101 i 101 i++ i++ i {
            if (set.contains(i)) {
                continue;
            }
            int t = Math.abs(i - X);
            if (t < diff) {
                ans = i;
                diff = t;
            }
        } {
            if (set.contains(i)) {
                continue;
            }
            int t = Math.abs(i - X);
            if (t < diff) {
                ans = i;
                diff = t;
            }
        } if (set.contains(i)) {
                continue;
            } set.contains(i) set.contains set i {
                continue;
            } continue; int t = Math.abs(i - X); t Math.abs(i - X) Math.abs Math i - X i X if (t < diff) {
                ans = i;
                diff = t;
            } t < diff t diff {
                ans = i;
                diff = t;
            } ans = i ans i diff = t diff t System.out.println(ans) System.out.println System.out System System.out ans public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }

    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int X = scan.nextInt();
        int N = scan.nextInt();
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < N; i++) {
            set.add(scan.nextInt());
        }
        int diff = Integer.MAX_VALUE;
        int ans = -1;
        for (int i = 0; i <= 101; i++) {
            if (set.contains(i)) {
                continue;
            }
            int t = Math.abs(i - X);
            if (t < diff) {
                ans = i;
                diff = t;
            }
        }
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }

    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int X = scan.nextInt();
        int N = scan.nextInt();
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < N; i++) {
            set.add(scan.nextInt());
        }
        int diff = Integer.MAX_VALUE;
        int ans = -1;
        for (int i = 0; i <= 101; i++) {
            if (set.contains(i)) {
                continue;
            }
            int t = Math.abs(i - X);
            if (t < diff) {
                ans = i;
                diff = t;
            }
        }
        System.out.println(ans);
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }

    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int X = scan.nextInt();
        int N = scan.nextInt();
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < N; i++) {
            set.add(scan.nextInt());
        }
        int diff = Integer.MAX_VALUE;
        int ans = -1;
        for (int i = 0; i <= 101; i++) {
            if (set.contains(i)) {
                continue;
            }
            int t = Math.abs(i - X);
            if (t < diff) {
                ans = i;
                diff = t;
            }
        }
        System.out.println(ans);
    }
}
