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

public class Main {
	
	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner();
		PrintWriter out = new PrintWriter(System.out);
		int X = sc.nextInt();
		int N = sc.nextInt();
		int[] vals = new int[N];
		for (int i = 0; i < N; i++) {
			vals[i] = sc.nextInt();
		}
		int ans = -1000;
		for (int i = 0; ans == -1000; i++) {
			for (int j = -1; j <= 1 && ans == -1000; j+=2) {
				int val = X + i * j;
				boolean can = true;
				for (int k = 0; k < N; k++) {
					if (vals[k] == val) {
						can = false;
						break;
					}
				}
				if (can) {
					ans = val;
				}
			}
		}
		out.println(ans);
		
		out.flush();
	}
	
	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;
		
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.PrintWriter; PrintWriter java.io import java.util.StringTokenizer; StringTokenizer java.util public class Main {
	
	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner();
		PrintWriter out = new PrintWriter(System.out);
		int X = sc.nextInt();
		int N = sc.nextInt();
		int[] vals = new int[N];
		for (int i = 0; i < N; i++) {
			vals[i] = sc.nextInt();
		}
		int ans = -1000;
		for (int i = 0; ans == -1000; i++) {
			for (int j = -1; j <= 1 && ans == -1000; j+=2) {
				int val = X + i * j;
				boolean can = true;
				for (int k = 0; k < N; k++) {
					if (vals[k] == val) {
						can = false;
						break;
					}
				}
				if (can) {
					ans = val;
				}
			}
		}
		out.println(ans);
		
		out.flush();
	}
	
	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;
		
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
} Main public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner();
		PrintWriter out = new PrintWriter(System.out);
		int X = sc.nextInt();
		int N = sc.nextInt();
		int[] vals = new int[N];
		for (int i = 0; i < N; i++) {
			vals[i] = sc.nextInt();
		}
		int ans = -1000;
		for (int i = 0; ans == -1000; i++) {
			for (int j = -1; j <= 1 && ans == -1000; j+=2) {
				int val = X + i * j;
				boolean can = true;
				for (int k = 0; k < N; k++) {
					if (vals[k] == val) {
						can = false;
						break;
					}
				}
				if (can) {
					ans = val;
				}
			}
		}
		out.println(ans);
		
		out.flush();
	} main {
		MyScanner sc = new MyScanner();
		PrintWriter out = new PrintWriter(System.out);
		int X = sc.nextInt();
		int N = sc.nextInt();
		int[] vals = new int[N];
		for (int i = 0; i < N; i++) {
			vals[i] = sc.nextInt();
		}
		int ans = -1000;
		for (int i = 0; ans == -1000; i++) {
			for (int j = -1; j <= 1 && ans == -1000; j+=2) {
				int val = X + i * j;
				boolean can = true;
				for (int k = 0; k < N; k++) {
					if (vals[k] == val) {
						can = false;
						break;
					}
				}
				if (can) {
					ans = val;
				}
			}
		}
		out.println(ans);
		
		out.flush();
	} MyScanner sc = new MyScanner(); sc new MyScanner() PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) int X = sc.nextInt(); X sc.nextInt() sc.nextInt sc int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] vals = new int[N]; vals new int[N] N for (int i = 0; i < N; i++) {
			vals[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			vals[i] = sc.nextInt();
		} {
			vals[i] = sc.nextInt();
		} vals[i] = sc.nextInt() vals[i] vals i sc.nextInt() sc.nextInt sc int ans = -1000; ans -1000 1000 for (int i = 0; ans == -1000; i++) {
			for (int j = -1; j <= 1 && ans == -1000; j+=2) {
				int val = X + i * j;
				boolean can = true;
				for (int k = 0; k < N; k++) {
					if (vals[k] == val) {
						can = false;
						break;
					}
				}
				if (can) {
					ans = val;
				}
			}
		} int i = 0; int i = 0; i 0 ans == -1000 ans -1000 1000 i++ i++ i {
			for (int j = -1; j <= 1 && ans == -1000; j+=2) {
				int val = X + i * j;
				boolean can = true;
				for (int k = 0; k < N; k++) {
					if (vals[k] == val) {
						can = false;
						break;
					}
				}
				if (can) {
					ans = val;
				}
			}
		} {
			for (int j = -1; j <= 1 && ans == -1000; j+=2) {
				int val = X + i * j;
				boolean can = true;
				for (int k = 0; k < N; k++) {
					if (vals[k] == val) {
						can = false;
						break;
					}
				}
				if (can) {
					ans = val;
				}
			}
		} for (int j = -1; j <= 1 && ans == -1000; j+=2) {
				int val = X + i * j;
				boolean can = true;
				for (int k = 0; k < N; k++) {
					if (vals[k] == val) {
						can = false;
						break;
					}
				}
				if (can) {
					ans = val;
				}
			} int j = -1; int j = -1; j -1 1 j <= 1 && ans == -1000 j <= 1 j 1 ans == -1000 ans -1000 1000 j+=2 j+=2 j 2 {
				int val = X + i * j;
				boolean can = true;
				for (int k = 0; k < N; k++) {
					if (vals[k] == val) {
						can = false;
						break;
					}
				}
				if (can) {
					ans = val;
				}
			} {
				int val = X + i * j;
				boolean can = true;
				for (int k = 0; k < N; k++) {
					if (vals[k] == val) {
						can = false;
						break;
					}
				}
				if (can) {
					ans = val;
				}
			} int val = X + i * j; val X + i * j X i * j i j boolean can = true; can true for (int k = 0; k < N; k++) {
					if (vals[k] == val) {
						can = false;
						break;
					}
				} int k = 0; int k = 0; k 0 k < N k N k++ k++ k {
					if (vals[k] == val) {
						can = false;
						break;
					}
				} {
					if (vals[k] == val) {
						can = false;
						break;
					}
				} if (vals[k] == val) {
						can = false;
						break;
					} vals[k] == val vals[k] vals k val {
						can = false;
						break;
					} can = false can false break; if (can) {
					ans = val;
				} can {
					ans = val;
				} ans = val ans val out.println(ans) out.println out ans out.flush() out.flush out String[] args args static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;
		
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
	} MyScanner private BufferedReader br; br private StringTokenizer tokenizer; tokenizer public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		} MyScanner {
			br = new BufferedReader(new InputStreamReader(System.in));
		} br = new BufferedReader(new InputStreamReader(System.in)) br new BufferedReader(new InputStreamReader(System.in)) public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		} next {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		} while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.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(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			} try {
					tokenizer = new StringTokenizer(br.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(br.readLine());
				} tokenizer = new StringTokenizer(br.readLine()) tokenizer new StringTokenizer(br.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 long nextLong() {
			return Long.parseLong(next());
		} nextLong {
			return Long.parseLong(next());
		} return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public class Main {
	
	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner();
		PrintWriter out = new PrintWriter(System.out);
		int X = sc.nextInt();
		int N = sc.nextInt();
		int[] vals = new int[N];
		for (int i = 0; i < N; i++) {
			vals[i] = sc.nextInt();
		}
		int ans = -1000;
		for (int i = 0; ans == -1000; i++) {
			for (int j = -1; j <= 1 && ans == -1000; j+=2) {
				int val = X + i * j;
				boolean can = true;
				for (int k = 0; k < N; k++) {
					if (vals[k] == val) {
						can = false;
						break;
					}
				}
				if (can) {
					ans = val;
				}
			}
		}
		out.println(ans);
		
		out.flush();
	}
	
	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;
		
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
} public class Main {
	
	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner();
		PrintWriter out = new PrintWriter(System.out);
		int X = sc.nextInt();
		int N = sc.nextInt();
		int[] vals = new int[N];
		for (int i = 0; i < N; i++) {
			vals[i] = sc.nextInt();
		}
		int ans = -1000;
		for (int i = 0; ans == -1000; i++) {
			for (int j = -1; j <= 1 && ans == -1000; j+=2) {
				int val = X + i * j;
				boolean can = true;
				for (int k = 0; k < N; k++) {
					if (vals[k] == val) {
						can = false;
						break;
					}
				}
				if (can) {
					ans = val;
				}
			}
		}
		out.println(ans);
		
		out.flush();
	}
	
	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;
		
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
	
	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner();
		PrintWriter out = new PrintWriter(System.out);
		int X = sc.nextInt();
		int N = sc.nextInt();
		int[] vals = new int[N];
		for (int i = 0; i < N; i++) {
			vals[i] = sc.nextInt();
		}
		int ans = -1000;
		for (int i = 0; ans == -1000; i++) {
			for (int j = -1; j <= 1 && ans == -1000; j+=2) {
				int val = X + i * j;
				boolean can = true;
				for (int k = 0; k < N; k++) {
					if (vals[k] == val) {
						can = false;
						break;
					}
				}
				if (can) {
					ans = val;
				}
			}
		}
		out.println(ans);
		
		out.flush();
	}
	
	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;
		
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}
