
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public final class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final int x = in.nextInt();
        final int n = in.nextInt();
        in.nextLine();
        final Set<Integer> set = IntStream.rangeClosed(0, 101).boxed().collect(Collectors.toSet());
        for (int i = 0; i < n; i++) {
            set.remove(in.nextInt());
        }
        int diff = Integer.MAX_VALUE;
        int res = Integer.MAX_VALUE;
        for (int item : set) {
            if (Math.abs(item - x) < diff) {
                diff = Math.abs(item - x);
                res = item;
            } else if (Math.abs(item - x) == diff) {
                res = Math.min(res, item);
            }
        }
        System.out.println(res);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Scanner; Scanner java.util import java.util.Set; Set java.util import java.util.stream.Collectors; Collectors java.util.stream import java.util.stream.IntStream; IntStream java.util.stream public final class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final int x = in.nextInt();
        final int n = in.nextInt();
        in.nextLine();
        final Set<Integer> set = IntStream.rangeClosed(0, 101).boxed().collect(Collectors.toSet());
        for (int i = 0; i < n; i++) {
            set.remove(in.nextInt());
        }
        int diff = Integer.MAX_VALUE;
        int res = Integer.MAX_VALUE;
        for (int item : set) {
            if (Math.abs(item - x) < diff) {
                diff = Math.abs(item - x);
                res = item;
            } else if (Math.abs(item - x) == diff) {
                res = Math.min(res, item);
            }
        }
        System.out.println(res);
    }
} Main public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final int x = in.nextInt();
        final int n = in.nextInt();
        in.nextLine();
        final Set<Integer> set = IntStream.rangeClosed(0, 101).boxed().collect(Collectors.toSet());
        for (int i = 0; i < n; i++) {
            set.remove(in.nextInt());
        }
        int diff = Integer.MAX_VALUE;
        int res = Integer.MAX_VALUE;
        for (int item : set) {
            if (Math.abs(item - x) < diff) {
                diff = Math.abs(item - x);
                res = item;
            } else if (Math.abs(item - x) == diff) {
                res = Math.min(res, item);
            }
        }
        System.out.println(res);
    } main {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final int x = in.nextInt();
        final int n = in.nextInt();
        in.nextLine();
        final Set<Integer> set = IntStream.rangeClosed(0, 101).boxed().collect(Collectors.toSet());
        for (int i = 0; i < n; i++) {
            set.remove(in.nextInt());
        }
        int diff = Integer.MAX_VALUE;
        int res = Integer.MAX_VALUE;
        for (int item : set) {
            if (Math.abs(item - x) < diff) {
                diff = Math.abs(item - x);
                res = item;
            } else if (Math.abs(item - x) == diff) {
                res = Math.min(res, item);
            }
        }
        System.out.println(res);
    } final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); in new Scanner(new BufferedReader(new InputStreamReader(System.in))) final int x = in.nextInt(); x in.nextInt() in.nextInt in final int n = in.nextInt(); n in.nextInt() in.nextInt in in.nextLine() in.nextLine in final Set<Integer> set = IntStream.rangeClosed(0, 101).boxed().collect(Collectors.toSet()); set IntStream.rangeClosed(0, 101).boxed().collect(Collectors.toSet()) IntStream.rangeClosed(0, 101).boxed().collect IntStream.rangeClosed(0, 101).boxed() IntStream.rangeClosed(0, 101).boxed IntStream.rangeClosed(0, 101) IntStream.rangeClosed IntStream 0 101 Collectors.toSet() Collectors.toSet Collectors for (int i = 0; i < n; i++) {
            set.remove(in.nextInt());
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            set.remove(in.nextInt());
        } {
            set.remove(in.nextInt());
        } set.remove(in.nextInt()) set.remove set in.nextInt() in.nextInt in int diff = Integer.MAX_VALUE; diff Integer.MAX_VALUE Integer Integer.MAX_VALUE int res = Integer.MAX_VALUE; res Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int item : set) {
            if (Math.abs(item - x) < diff) {
                diff = Math.abs(item - x);
                res = item;
            } else if (Math.abs(item - x) == diff) {
                res = Math.min(res, item);
            }
        } int item set {
            if (Math.abs(item - x) < diff) {
                diff = Math.abs(item - x);
                res = item;
            } else if (Math.abs(item - x) == diff) {
                res = Math.min(res, item);
            }
        } {
            if (Math.abs(item - x) < diff) {
                diff = Math.abs(item - x);
                res = item;
            } else if (Math.abs(item - x) == diff) {
                res = Math.min(res, item);
            }
        } if (Math.abs(item - x) < diff) {
                diff = Math.abs(item - x);
                res = item;
            } else if (Math.abs(item - x) == diff) {
                res = Math.min(res, item);
            } Math.abs(item - x) < diff Math.abs(item - x) Math.abs Math item - x item x diff {
                diff = Math.abs(item - x);
                res = item;
            } diff = Math.abs(item - x) diff Math.abs(item - x) Math.abs Math item - x item x res = item res item if (Math.abs(item - x) == diff) {
                res = Math.min(res, item);
            } Math.abs(item - x) == diff Math.abs(item - x) Math.abs Math item - x item x diff {
                res = Math.min(res, item);
            } res = Math.min(res, item) res Math.min(res, item) Math.min Math res item System.out.println(res) System.out.println System.out System System.out res String[] args args public final class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final int x = in.nextInt();
        final int n = in.nextInt();
        in.nextLine();
        final Set<Integer> set = IntStream.rangeClosed(0, 101).boxed().collect(Collectors.toSet());
        for (int i = 0; i < n; i++) {
            set.remove(in.nextInt());
        }
        int diff = Integer.MAX_VALUE;
        int res = Integer.MAX_VALUE;
        for (int item : set) {
            if (Math.abs(item - x) < diff) {
                diff = Math.abs(item - x);
                res = item;
            } else if (Math.abs(item - x) == diff) {
                res = Math.min(res, item);
            }
        }
        System.out.println(res);
    }
} public final class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final int x = in.nextInt();
        final int n = in.nextInt();
        in.nextLine();
        final Set<Integer> set = IntStream.rangeClosed(0, 101).boxed().collect(Collectors.toSet());
        for (int i = 0; i < n; i++) {
            set.remove(in.nextInt());
        }
        int diff = Integer.MAX_VALUE;
        int res = Integer.MAX_VALUE;
        for (int item : set) {
            if (Math.abs(item - x) < diff) {
                diff = Math.abs(item - x);
                res = item;
            } else if (Math.abs(item - x) == diff) {
                res = Math.min(res, item);
            }
        }
        System.out.println(res);
    }
} Main

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public final class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final int x = in.nextInt();
        final int n = in.nextInt();
        in.nextLine();
        final Set<Integer> set = IntStream.rangeClosed(0, 101).boxed().collect(Collectors.toSet());
        for (int i = 0; i < n; i++) {
            set.remove(in.nextInt());
        }
        int diff = Integer.MAX_VALUE;
        int res = Integer.MAX_VALUE;
        for (int item : set) {
            if (Math.abs(item - x) < diff) {
                diff = Math.abs(item - x);
                res = item;
            } else if (Math.abs(item - x) == diff) {
                res = Math.min(res, item);
            }
        }
        System.out.println(res);
    }
}
