import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt(), n = sc.nextInt();
		int[] a = new int[n];
		List<Integer> list = new ArrayList<Integer>();
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		int r = Integer.MAX_VALUE;
		int res = -1;
		for (int i=-5;i<=100+5;i++) {
			if (!list.contains(i)) {
			int t = Math.abs(i - x);
				if (r > t) {
					r = t;
					res = i;
				}
			}
		}
		System.out.println(res);
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt(), n = sc.nextInt();
		int[] a = new int[n];
		List<Integer> list = new ArrayList<Integer>();
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		int r = Integer.MAX_VALUE;
		int res = -1;
		for (int i=-5;i<=100+5;i++) {
			if (!list.contains(i)) {
			int t = Math.abs(i - x);
				if (r > t) {
					r = t;
					res = i;
				}
			}
		}
		System.out.println(res);
	}
} Main public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt(), n = sc.nextInt();
		int[] a = new int[n];
		List<Integer> list = new ArrayList<Integer>();
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		int r = Integer.MAX_VALUE;
		int res = -1;
		for (int i=-5;i<=100+5;i++) {
			if (!list.contains(i)) {
			int t = Math.abs(i - x);
				if (r > t) {
					r = t;
					res = i;
				}
			}
		}
		System.out.println(res);
	} main {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt(), n = sc.nextInt();
		int[] a = new int[n];
		List<Integer> list = new ArrayList<Integer>();
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		int r = Integer.MAX_VALUE;
		int res = -1;
		for (int i=-5;i<=100+5;i++) {
			if (!list.contains(i)) {
			int t = Math.abs(i - x);
				if (r > t) {
					r = t;
					res = i;
				}
			}
		}
		System.out.println(res);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x = sc.nextInt() x sc.nextInt() sc.nextInt sc n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] a = new int[n]; a new int[n] n List<Integer> list = new ArrayList<Integer>(); list new ArrayList<Integer>() 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 int r = Integer.MAX_VALUE; r Integer.MAX_VALUE Integer Integer.MAX_VALUE int res = -1; res -1 1 for (int i=-5;i<=100+5;i++) {
			if (!list.contains(i)) {
			int t = Math.abs(i - x);
				if (r > t) {
					r = t;
					res = i;
				}
			}
		} int i=-5; int i=-5; i -5 5 i<=100+5 i 100+5 100 5 i++ i++ i {
			if (!list.contains(i)) {
			int t = Math.abs(i - x);
				if (r > t) {
					r = t;
					res = i;
				}
			}
		} {
			if (!list.contains(i)) {
			int t = Math.abs(i - x);
				if (r > t) {
					r = t;
					res = i;
				}
			}
		} if (!list.contains(i)) {
			int t = Math.abs(i - x);
				if (r > t) {
					r = t;
					res = i;
				}
			} !list.contains(i) list.contains(i) list.contains list i {
			int t = Math.abs(i - x);
				if (r > t) {
					r = t;
					res = i;
				}
			} int t = Math.abs(i - x); t Math.abs(i - x) Math.abs Math i - x i x if (r > t) {
					r = t;
					res = i;
				} r > t r t {
					r = t;
					res = i;
				} r = t r t res = i res i System.out.println(res) System.out.println System.out System System.out res final String[] args args public class Main {

	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt(), n = sc.nextInt();
		int[] a = new int[n];
		List<Integer> list = new ArrayList<Integer>();
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		int r = Integer.MAX_VALUE;
		int res = -1;
		for (int i=-5;i<=100+5;i++) {
			if (!list.contains(i)) {
			int t = Math.abs(i - x);
				if (r > t) {
					r = t;
					res = i;
				}
			}
		}
		System.out.println(res);
	}
} public class Main {

	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt(), n = sc.nextInt();
		int[] a = new int[n];
		List<Integer> list = new ArrayList<Integer>();
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		int r = Integer.MAX_VALUE;
		int res = -1;
		for (int i=-5;i<=100+5;i++) {
			if (!list.contains(i)) {
			int t = Math.abs(i - x);
				if (r > t) {
					r = t;
					res = i;
				}
			}
		}
		System.out.println(res);
	}
} Main
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt(), n = sc.nextInt();
		int[] a = new int[n];
		List<Integer> list = new ArrayList<Integer>();
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		int r = Integer.MAX_VALUE;
		int res = -1;
		for (int i=-5;i<=100+5;i++) {
			if (!list.contains(i)) {
			int t = Math.abs(i - x);
				if (r > t) {
					r = t;
					res = i;
				}
			}
		}
		System.out.println(res);
	}
}
