import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);

		int X = sc.nextInt();
		int N = sc.nextInt();

		if (N == 0) {
			System.out.println(X);
		}
		else {
			int[] numbers = new int[N];
			for (int i=0; i < N; i++) {
				numbers[i] = sc.nextInt();
			}

			int min = -1;
			for (int j=X; j >= 0; j--) {
				boolean found = false;
				for (int i=0; i < N; i++) {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				}
				if (!found) {
					min = j;
					break;
				}
			}

			int max = -1;
			for (int j=X+1; j <= 101; j++) {
				boolean found = false;
				for (int i=0; i < N; i++) {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				}
				if (!found) {
					max = j;
					break;
				}
			}

			if (max == -1 && min != -1) {
				System.out.println(min);
			}
			else if (min == -1 && max != -1) {
				System.out.println(max);
			}
			else {
				if ((X-min) <= (max-X)) {
					System.out.println(min);
				}
				else {
					System.out.println(max);
				}
			}
		}
	}

	private static class FastScanner {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;

		public FastScanner(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
			tokenizer = null;
		}

		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.StringTokenizer; StringTokenizer java.util public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);

		int X = sc.nextInt();
		int N = sc.nextInt();

		if (N == 0) {
			System.out.println(X);
		}
		else {
			int[] numbers = new int[N];
			for (int i=0; i < N; i++) {
				numbers[i] = sc.nextInt();
			}

			int min = -1;
			for (int j=X; j >= 0; j--) {
				boolean found = false;
				for (int i=0; i < N; i++) {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				}
				if (!found) {
					min = j;
					break;
				}
			}

			int max = -1;
			for (int j=X+1; j <= 101; j++) {
				boolean found = false;
				for (int i=0; i < N; i++) {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				}
				if (!found) {
					max = j;
					break;
				}
			}

			if (max == -1 && min != -1) {
				System.out.println(min);
			}
			else if (min == -1 && max != -1) {
				System.out.println(max);
			}
			else {
				if ((X-min) <= (max-X)) {
					System.out.println(min);
				}
				else {
					System.out.println(max);
				}
			}
		}
	}

	private static class FastScanner {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;

		public FastScanner(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
			tokenizer = null;
		}

		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

	}
} Main public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);

		int X = sc.nextInt();
		int N = sc.nextInt();

		if (N == 0) {
			System.out.println(X);
		}
		else {
			int[] numbers = new int[N];
			for (int i=0; i < N; i++) {
				numbers[i] = sc.nextInt();
			}

			int min = -1;
			for (int j=X; j >= 0; j--) {
				boolean found = false;
				for (int i=0; i < N; i++) {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				}
				if (!found) {
					min = j;
					break;
				}
			}

			int max = -1;
			for (int j=X+1; j <= 101; j++) {
				boolean found = false;
				for (int i=0; i < N; i++) {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				}
				if (!found) {
					max = j;
					break;
				}
			}

			if (max == -1 && min != -1) {
				System.out.println(min);
			}
			else if (min == -1 && max != -1) {
				System.out.println(max);
			}
			else {
				if ((X-min) <= (max-X)) {
					System.out.println(min);
				}
				else {
					System.out.println(max);
				}
			}
		}
	} main {
		FastScanner sc = new FastScanner(System.in);

		int X = sc.nextInt();
		int N = sc.nextInt();

		if (N == 0) {
			System.out.println(X);
		}
		else {
			int[] numbers = new int[N];
			for (int i=0; i < N; i++) {
				numbers[i] = sc.nextInt();
			}

			int min = -1;
			for (int j=X; j >= 0; j--) {
				boolean found = false;
				for (int i=0; i < N; i++) {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				}
				if (!found) {
					min = j;
					break;
				}
			}

			int max = -1;
			for (int j=X+1; j <= 101; j++) {
				boolean found = false;
				for (int i=0; i < N; i++) {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				}
				if (!found) {
					max = j;
					break;
				}
			}

			if (max == -1 && min != -1) {
				System.out.println(min);
			}
			else if (min == -1 && max != -1) {
				System.out.println(max);
			}
			else {
				if ((X-min) <= (max-X)) {
					System.out.println(min);
				}
				else {
					System.out.println(max);
				}
			}
		}
	} FastScanner sc = new FastScanner(System.in); sc new FastScanner(System.in) int X = sc.nextInt(); X sc.nextInt() sc.nextInt sc int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc if (N == 0) {
			System.out.println(X);
		}
		else {
			int[] numbers = new int[N];
			for (int i=0; i < N; i++) {
				numbers[i] = sc.nextInt();
			}

			int min = -1;
			for (int j=X; j >= 0; j--) {
				boolean found = false;
				for (int i=0; i < N; i++) {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				}
				if (!found) {
					min = j;
					break;
				}
			}

			int max = -1;
			for (int j=X+1; j <= 101; j++) {
				boolean found = false;
				for (int i=0; i < N; i++) {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				}
				if (!found) {
					max = j;
					break;
				}
			}

			if (max == -1 && min != -1) {
				System.out.println(min);
			}
			else if (min == -1 && max != -1) {
				System.out.println(max);
			}
			else {
				if ((X-min) <= (max-X)) {
					System.out.println(min);
				}
				else {
					System.out.println(max);
				}
			}
		} N == 0 N 0 {
			System.out.println(X);
		} System.out.println(X) System.out.println System.out System System.out X {
			int[] numbers = new int[N];
			for (int i=0; i < N; i++) {
				numbers[i] = sc.nextInt();
			}

			int min = -1;
			for (int j=X; j >= 0; j--) {
				boolean found = false;
				for (int i=0; i < N; i++) {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				}
				if (!found) {
					min = j;
					break;
				}
			}

			int max = -1;
			for (int j=X+1; j <= 101; j++) {
				boolean found = false;
				for (int i=0; i < N; i++) {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				}
				if (!found) {
					max = j;
					break;
				}
			}

			if (max == -1 && min != -1) {
				System.out.println(min);
			}
			else if (min == -1 && max != -1) {
				System.out.println(max);
			}
			else {
				if ((X-min) <= (max-X)) {
					System.out.println(min);
				}
				else {
					System.out.println(max);
				}
			}
		} int[] numbers = new int[N]; numbers new int[N] N for (int i=0; i < N; i++) {
				numbers[i] = sc.nextInt();
			} int i=0; int i=0; i 0 i < N i N i++ i++ i {
				numbers[i] = sc.nextInt();
			} {
				numbers[i] = sc.nextInt();
			} numbers[i] = sc.nextInt() numbers[i] numbers i sc.nextInt() sc.nextInt sc int min = -1; min -1 1 for (int j=X; j >= 0; j--) {
				boolean found = false;
				for (int i=0; i < N; i++) {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				}
				if (!found) {
					min = j;
					break;
				}
			} int j=X; int j=X; j X j >= 0 j 0 j-- j-- j {
				boolean found = false;
				for (int i=0; i < N; i++) {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				}
				if (!found) {
					min = j;
					break;
				}
			} {
				boolean found = false;
				for (int i=0; i < N; i++) {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				}
				if (!found) {
					min = j;
					break;
				}
			} boolean found = false; found false for (int i=0; i < N; i++) {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				} int i=0; int i=0; i 0 i < N i N i++ i++ i {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				} {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				} if (numbers[i] == j) {
						found = true;
						break;
					} numbers[i] == j numbers[i] numbers i j {
						found = true;
						break;
					} found = true found true break; if (!found) {
					min = j;
					break;
				} !found found {
					min = j;
					break;
				} min = j min j break; int max = -1; max -1 1 for (int j=X+1; j <= 101; j++) {
				boolean found = false;
				for (int i=0; i < N; i++) {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				}
				if (!found) {
					max = j;
					break;
				}
			} int j=X+1; int j=X+1; j X+1 X 1 j <= 101 j 101 j++ j++ j {
				boolean found = false;
				for (int i=0; i < N; i++) {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				}
				if (!found) {
					max = j;
					break;
				}
			} {
				boolean found = false;
				for (int i=0; i < N; i++) {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				}
				if (!found) {
					max = j;
					break;
				}
			} boolean found = false; found false for (int i=0; i < N; i++) {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				} int i=0; int i=0; i 0 i < N i N i++ i++ i {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				} {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				} if (numbers[i] == j) {
						found = true;
						break;
					} numbers[i] == j numbers[i] numbers i j {
						found = true;
						break;
					} found = true found true break; if (!found) {
					max = j;
					break;
				} !found found {
					max = j;
					break;
				} max = j max j break; if (max == -1 && min != -1) {
				System.out.println(min);
			}
			else if (min == -1 && max != -1) {
				System.out.println(max);
			}
			else {
				if ((X-min) <= (max-X)) {
					System.out.println(min);
				}
				else {
					System.out.println(max);
				}
			} max == -1 && min != -1 max == -1 max -1 1 min != -1 min -1 1 {
				System.out.println(min);
			} System.out.println(min) System.out.println System.out System System.out min if (min == -1 && max != -1) {
				System.out.println(max);
			}
			else {
				if ((X-min) <= (max-X)) {
					System.out.println(min);
				}
				else {
					System.out.println(max);
				}
			} min == -1 && max != -1 min == -1 min -1 1 max != -1 max -1 1 {
				System.out.println(max);
			} System.out.println(max) System.out.println System.out System System.out max {
				if ((X-min) <= (max-X)) {
					System.out.println(min);
				}
				else {
					System.out.println(max);
				}
			} if ((X-min) <= (max-X)) {
					System.out.println(min);
				}
				else {
					System.out.println(max);
				} (X-min) <= (max-X) (X-min) X min (max-X) max X {
					System.out.println(min);
				} System.out.println(min) System.out.println System.out System System.out min {
					System.out.println(max);
				} System.out.println(max) System.out.println System.out System System.out max String[] args args private static class FastScanner {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;

		public FastScanner(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
			tokenizer = null;
		}

		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

	} FastScanner private BufferedReader reader = null; reader null private StringTokenizer tokenizer = null; tokenizer null public FastScanner(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
			tokenizer = null;
		} FastScanner {
			reader = new BufferedReader(new InputStreamReader(in));
			tokenizer = null;
		} reader = new BufferedReader(new InputStreamReader(in)) reader new BufferedReader(new InputStreamReader(in)) tokenizer = null tokenizer null InputStream in in public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		} next {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		} if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			} tokenizer == null || !tokenizer.hasMoreTokens() tokenizer == null tokenizer null !tokenizer.hasMoreTokens() tokenizer.hasMoreTokens() tokenizer.hasMoreTokens tokenizer {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			} try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				} catch (IOException e) {
					throw new RuntimeException(e);
				} IOException e {
					throw new RuntimeException(e);
				} throw new RuntimeException(e); new RuntimeException(e) {
					tokenizer = new StringTokenizer(reader.readLine());
				} tokenizer = new StringTokenizer(reader.readLine()) tokenizer new StringTokenizer(reader.readLine()) return tokenizer.nextToken(); tokenizer.nextToken() tokenizer.nextToken tokenizer public int nextInt() {
			return Integer.parseInt(next());
		} nextInt {
			return Integer.parseInt(next());
		} return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);

		int X = sc.nextInt();
		int N = sc.nextInt();

		if (N == 0) {
			System.out.println(X);
		}
		else {
			int[] numbers = new int[N];
			for (int i=0; i < N; i++) {
				numbers[i] = sc.nextInt();
			}

			int min = -1;
			for (int j=X; j >= 0; j--) {
				boolean found = false;
				for (int i=0; i < N; i++) {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				}
				if (!found) {
					min = j;
					break;
				}
			}

			int max = -1;
			for (int j=X+1; j <= 101; j++) {
				boolean found = false;
				for (int i=0; i < N; i++) {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				}
				if (!found) {
					max = j;
					break;
				}
			}

			if (max == -1 && min != -1) {
				System.out.println(min);
			}
			else if (min == -1 && max != -1) {
				System.out.println(max);
			}
			else {
				if ((X-min) <= (max-X)) {
					System.out.println(min);
				}
				else {
					System.out.println(max);
				}
			}
		}
	}

	private static class FastScanner {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;

		public FastScanner(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
			tokenizer = null;
		}

		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

	}
} public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);

		int X = sc.nextInt();
		int N = sc.nextInt();

		if (N == 0) {
			System.out.println(X);
		}
		else {
			int[] numbers = new int[N];
			for (int i=0; i < N; i++) {
				numbers[i] = sc.nextInt();
			}

			int min = -1;
			for (int j=X; j >= 0; j--) {
				boolean found = false;
				for (int i=0; i < N; i++) {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				}
				if (!found) {
					min = j;
					break;
				}
			}

			int max = -1;
			for (int j=X+1; j <= 101; j++) {
				boolean found = false;
				for (int i=0; i < N; i++) {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				}
				if (!found) {
					max = j;
					break;
				}
			}

			if (max == -1 && min != -1) {
				System.out.println(min);
			}
			else if (min == -1 && max != -1) {
				System.out.println(max);
			}
			else {
				if ((X-min) <= (max-X)) {
					System.out.println(min);
				}
				else {
					System.out.println(max);
				}
			}
		}
	}

	private static class FastScanner {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;

		public FastScanner(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
			tokenizer = null;
		}

		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);

		int X = sc.nextInt();
		int N = sc.nextInt();

		if (N == 0) {
			System.out.println(X);
		}
		else {
			int[] numbers = new int[N];
			for (int i=0; i < N; i++) {
				numbers[i] = sc.nextInt();
			}

			int min = -1;
			for (int j=X; j >= 0; j--) {
				boolean found = false;
				for (int i=0; i < N; i++) {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				}
				if (!found) {
					min = j;
					break;
				}
			}

			int max = -1;
			for (int j=X+1; j <= 101; j++) {
				boolean found = false;
				for (int i=0; i < N; i++) {
					if (numbers[i] == j) {
						found = true;
						break;
					}
				}
				if (!found) {
					max = j;
					break;
				}
			}

			if (max == -1 && min != -1) {
				System.out.println(min);
			}
			else if (min == -1 && max != -1) {
				System.out.println(max);
			}
			else {
				if ((X-min) <= (max-X)) {
					System.out.println(min);
				}
				else {
					System.out.println(max);
				}
			}
		}
	}

	private static class FastScanner {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;

		public FastScanner(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
			tokenizer = null;
		}

		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

	}
}
