import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int x = scanner.nextInt();
		int n = scanner.nextInt();
		int[] p = new int[n];
		int ans = x;
		int dif = 1;
		int flag = 1;
		
		for (int i = 0; i < n; i++) {
			p[i] = scanner.nextInt();
		}
		
		for (int i = 0; i < n; i++) {
			if (p[i] == x) {
				flag = 0;
				break;
			}
		}
		
		while (flag == 0) {
			flag = 1;
			
			for (int i = 0; i < n; i++) {
				if (p[i] == x - dif) {
					flag = 0;
					break;
				}
			}
			
			if (flag == 1) {
				ans = x - dif;
				break;
			}
			
			flag = 1;
			
			for (int i = 0; i < n; i++) {
				if (p[i] == x + dif) {
					flag = 0;
					break;
				}
			}
			
			if (flag == 1) {
				ans = x + dif;
				break;
			}
			
			dif++;
		}
		
		System.out.println(ans);

	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int x = scanner.nextInt();
		int n = scanner.nextInt();
		int[] p = new int[n];
		int ans = x;
		int dif = 1;
		int flag = 1;
		
		for (int i = 0; i < n; i++) {
			p[i] = scanner.nextInt();
		}
		
		for (int i = 0; i < n; i++) {
			if (p[i] == x) {
				flag = 0;
				break;
			}
		}
		
		while (flag == 0) {
			flag = 1;
			
			for (int i = 0; i < n; i++) {
				if (p[i] == x - dif) {
					flag = 0;
					break;
				}
			}
			
			if (flag == 1) {
				ans = x - dif;
				break;
			}
			
			flag = 1;
			
			for (int i = 0; i < n; i++) {
				if (p[i] == x + dif) {
					flag = 0;
					break;
				}
			}
			
			if (flag == 1) {
				ans = x + dif;
				break;
			}
			
			dif++;
		}
		
		System.out.println(ans);

	}

} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int x = scanner.nextInt();
		int n = scanner.nextInt();
		int[] p = new int[n];
		int ans = x;
		int dif = 1;
		int flag = 1;
		
		for (int i = 0; i < n; i++) {
			p[i] = scanner.nextInt();
		}
		
		for (int i = 0; i < n; i++) {
			if (p[i] == x) {
				flag = 0;
				break;
			}
		}
		
		while (flag == 0) {
			flag = 1;
			
			for (int i = 0; i < n; i++) {
				if (p[i] == x - dif) {
					flag = 0;
					break;
				}
			}
			
			if (flag == 1) {
				ans = x - dif;
				break;
			}
			
			flag = 1;
			
			for (int i = 0; i < n; i++) {
				if (p[i] == x + dif) {
					flag = 0;
					break;
				}
			}
			
			if (flag == 1) {
				ans = x + dif;
				break;
			}
			
			dif++;
		}
		
		System.out.println(ans);

	} main {
		Scanner scanner = new Scanner(System.in);
		
		int x = scanner.nextInt();
		int n = scanner.nextInt();
		int[] p = new int[n];
		int ans = x;
		int dif = 1;
		int flag = 1;
		
		for (int i = 0; i < n; i++) {
			p[i] = scanner.nextInt();
		}
		
		for (int i = 0; i < n; i++) {
			if (p[i] == x) {
				flag = 0;
				break;
			}
		}
		
		while (flag == 0) {
			flag = 1;
			
			for (int i = 0; i < n; i++) {
				if (p[i] == x - dif) {
					flag = 0;
					break;
				}
			}
			
			if (flag == 1) {
				ans = x - dif;
				break;
			}
			
			flag = 1;
			
			for (int i = 0; i < n; i++) {
				if (p[i] == x + dif) {
					flag = 0;
					break;
				}
			}
			
			if (flag == 1) {
				ans = x + dif;
				break;
			}
			
			dif++;
		}
		
		System.out.println(ans);

	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int x = scanner.nextInt(); x scanner.nextInt() scanner.nextInt scanner int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int[] p = new int[n]; p new int[n] n int ans = x; ans x int dif = 1; dif 1 int flag = 1; flag 1 for (int i = 0; i < n; i++) {
			p[i] = scanner.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			p[i] = scanner.nextInt();
		} {
			p[i] = scanner.nextInt();
		} p[i] = scanner.nextInt() p[i] p i scanner.nextInt() scanner.nextInt scanner for (int i = 0; i < n; i++) {
			if (p[i] == x) {
				flag = 0;
				break;
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			if (p[i] == x) {
				flag = 0;
				break;
			}
		} {
			if (p[i] == x) {
				flag = 0;
				break;
			}
		} if (p[i] == x) {
				flag = 0;
				break;
			} p[i] == x p[i] p i x {
				flag = 0;
				break;
			} flag = 0 flag 0 break; while (flag == 0) {
			flag = 1;
			
			for (int i = 0; i < n; i++) {
				if (p[i] == x - dif) {
					flag = 0;
					break;
				}
			}
			
			if (flag == 1) {
				ans = x - dif;
				break;
			}
			
			flag = 1;
			
			for (int i = 0; i < n; i++) {
				if (p[i] == x + dif) {
					flag = 0;
					break;
				}
			}
			
			if (flag == 1) {
				ans = x + dif;
				break;
			}
			
			dif++;
		} flag == 0 flag 0 {
			flag = 1;
			
			for (int i = 0; i < n; i++) {
				if (p[i] == x - dif) {
					flag = 0;
					break;
				}
			}
			
			if (flag == 1) {
				ans = x - dif;
				break;
			}
			
			flag = 1;
			
			for (int i = 0; i < n; i++) {
				if (p[i] == x + dif) {
					flag = 0;
					break;
				}
			}
			
			if (flag == 1) {
				ans = x + dif;
				break;
			}
			
			dif++;
		} flag = 1 flag 1 for (int i = 0; i < n; i++) {
				if (p[i] == x - dif) {
					flag = 0;
					break;
				}
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				if (p[i] == x - dif) {
					flag = 0;
					break;
				}
			} {
				if (p[i] == x - dif) {
					flag = 0;
					break;
				}
			} if (p[i] == x - dif) {
					flag = 0;
					break;
				} p[i] == x - dif p[i] p i x - dif x dif {
					flag = 0;
					break;
				} flag = 0 flag 0 break; if (flag == 1) {
				ans = x - dif;
				break;
			} flag == 1 flag 1 {
				ans = x - dif;
				break;
			} ans = x - dif ans x - dif x dif break; flag = 1 flag 1 for (int i = 0; i < n; i++) {
				if (p[i] == x + dif) {
					flag = 0;
					break;
				}
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				if (p[i] == x + dif) {
					flag = 0;
					break;
				}
			} {
				if (p[i] == x + dif) {
					flag = 0;
					break;
				}
			} if (p[i] == x + dif) {
					flag = 0;
					break;
				} p[i] == x + dif p[i] p i x + dif x dif {
					flag = 0;
					break;
				} flag = 0 flag 0 break; if (flag == 1) {
				ans = x + dif;
				break;
			} flag == 1 flag 1 {
				ans = x + dif;
				break;
			} ans = x + dif ans x + dif x dif break; dif++ dif System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int x = scanner.nextInt();
		int n = scanner.nextInt();
		int[] p = new int[n];
		int ans = x;
		int dif = 1;
		int flag = 1;
		
		for (int i = 0; i < n; i++) {
			p[i] = scanner.nextInt();
		}
		
		for (int i = 0; i < n; i++) {
			if (p[i] == x) {
				flag = 0;
				break;
			}
		}
		
		while (flag == 0) {
			flag = 1;
			
			for (int i = 0; i < n; i++) {
				if (p[i] == x - dif) {
					flag = 0;
					break;
				}
			}
			
			if (flag == 1) {
				ans = x - dif;
				break;
			}
			
			flag = 1;
			
			for (int i = 0; i < n; i++) {
				if (p[i] == x + dif) {
					flag = 0;
					break;
				}
			}
			
			if (flag == 1) {
				ans = x + dif;
				break;
			}
			
			dif++;
		}
		
		System.out.println(ans);

	}

} public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int x = scanner.nextInt();
		int n = scanner.nextInt();
		int[] p = new int[n];
		int ans = x;
		int dif = 1;
		int flag = 1;
		
		for (int i = 0; i < n; i++) {
			p[i] = scanner.nextInt();
		}
		
		for (int i = 0; i < n; i++) {
			if (p[i] == x) {
				flag = 0;
				break;
			}
		}
		
		while (flag == 0) {
			flag = 1;
			
			for (int i = 0; i < n; i++) {
				if (p[i] == x - dif) {
					flag = 0;
					break;
				}
			}
			
			if (flag == 1) {
				ans = x - dif;
				break;
			}
			
			flag = 1;
			
			for (int i = 0; i < n; i++) {
				if (p[i] == x + dif) {
					flag = 0;
					break;
				}
			}
			
			if (flag == 1) {
				ans = x + dif;
				break;
			}
			
			dif++;
		}
		
		System.out.println(ans);

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int x = scanner.nextInt();
		int n = scanner.nextInt();
		int[] p = new int[n];
		int ans = x;
		int dif = 1;
		int flag = 1;
		
		for (int i = 0; i < n; i++) {
			p[i] = scanner.nextInt();
		}
		
		for (int i = 0; i < n; i++) {
			if (p[i] == x) {
				flag = 0;
				break;
			}
		}
		
		while (flag == 0) {
			flag = 1;
			
			for (int i = 0; i < n; i++) {
				if (p[i] == x - dif) {
					flag = 0;
					break;
				}
			}
			
			if (flag == 1) {
				ans = x - dif;
				break;
			}
			
			flag = 1;
			
			for (int i = 0; i < n; i++) {
				if (p[i] == x + dif) {
					flag = 0;
					break;
				}
			}
			
			if (flag == 1) {
				ans = x + dif;
				break;
			}
			
			dif++;
		}
		
		System.out.println(ans);

	}

}
