import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int x = scn.nextInt(), n = scn.nextInt();
		int[] arr = new int[102];
		for (int i = 0; i < n; i++) {
			arr[scn.nextInt()] = 1;
		}
		if (arr[x] == 0) {
			System.out.println(x);
		} else {
			int left = x - 1, right = x + 1;
			int ans = Integer.MAX_VALUE;
			while (left >= 0 && right < arr.length) {
				if (arr[left] == 0) {
					ans = left;
					break;
				} else {
					left--;
				}
				if (arr[right] == 0) {
					ans = right;
					break;
				} else {
					right++;
				}
			}
			while (left < 0 && right < arr.length) {
				if (arr[right] == 0) {
					ans = right;
					break;
				} else {
					right++;
				}
			}
			while (right >= arr.length && left >= 0) {
				if (arr[left] == 0) {
					ans = left;
					break;
				} else {
					left--;
				}
			}
			System.out.println(ans);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int x = scn.nextInt(), n = scn.nextInt();
		int[] arr = new int[102];
		for (int i = 0; i < n; i++) {
			arr[scn.nextInt()] = 1;
		}
		if (arr[x] == 0) {
			System.out.println(x);
		} else {
			int left = x - 1, right = x + 1;
			int ans = Integer.MAX_VALUE;
			while (left >= 0 && right < arr.length) {
				if (arr[left] == 0) {
					ans = left;
					break;
				} else {
					left--;
				}
				if (arr[right] == 0) {
					ans = right;
					break;
				} else {
					right++;
				}
			}
			while (left < 0 && right < arr.length) {
				if (arr[right] == 0) {
					ans = right;
					break;
				} else {
					right++;
				}
			}
			while (right >= arr.length && left >= 0) {
				if (arr[left] == 0) {
					ans = left;
					break;
				} else {
					left--;
				}
			}
			System.out.println(ans);
		}
	}
} Main public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int x = scn.nextInt(), n = scn.nextInt();
		int[] arr = new int[102];
		for (int i = 0; i < n; i++) {
			arr[scn.nextInt()] = 1;
		}
		if (arr[x] == 0) {
			System.out.println(x);
		} else {
			int left = x - 1, right = x + 1;
			int ans = Integer.MAX_VALUE;
			while (left >= 0 && right < arr.length) {
				if (arr[left] == 0) {
					ans = left;
					break;
				} else {
					left--;
				}
				if (arr[right] == 0) {
					ans = right;
					break;
				} else {
					right++;
				}
			}
			while (left < 0 && right < arr.length) {
				if (arr[right] == 0) {
					ans = right;
					break;
				} else {
					right++;
				}
			}
			while (right >= arr.length && left >= 0) {
				if (arr[left] == 0) {
					ans = left;
					break;
				} else {
					left--;
				}
			}
			System.out.println(ans);
		}
	} main {
		Scanner scn = new Scanner(System.in);
		int x = scn.nextInt(), n = scn.nextInt();
		int[] arr = new int[102];
		for (int i = 0; i < n; i++) {
			arr[scn.nextInt()] = 1;
		}
		if (arr[x] == 0) {
			System.out.println(x);
		} else {
			int left = x - 1, right = x + 1;
			int ans = Integer.MAX_VALUE;
			while (left >= 0 && right < arr.length) {
				if (arr[left] == 0) {
					ans = left;
					break;
				} else {
					left--;
				}
				if (arr[right] == 0) {
					ans = right;
					break;
				} else {
					right++;
				}
			}
			while (left < 0 && right < arr.length) {
				if (arr[right] == 0) {
					ans = right;
					break;
				} else {
					right++;
				}
			}
			while (right >= arr.length && left >= 0) {
				if (arr[left] == 0) {
					ans = left;
					break;
				} else {
					left--;
				}
			}
			System.out.println(ans);
		}
	} Scanner scn = new Scanner(System.in); scn new Scanner(System.in) int x = scn.nextInt() x scn.nextInt() scn.nextInt scn n = scn.nextInt(); n scn.nextInt() scn.nextInt scn int[] arr = new int[102]; arr new int[102] 102 for (int i = 0; i < n; i++) {
			arr[scn.nextInt()] = 1;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			arr[scn.nextInt()] = 1;
		} {
			arr[scn.nextInt()] = 1;
		} arr[scn.nextInt()] = 1 arr[scn.nextInt()] arr scn.nextInt() scn.nextInt scn 1 if (arr[x] == 0) {
			System.out.println(x);
		} else {
			int left = x - 1, right = x + 1;
			int ans = Integer.MAX_VALUE;
			while (left >= 0 && right < arr.length) {
				if (arr[left] == 0) {
					ans = left;
					break;
				} else {
					left--;
				}
				if (arr[right] == 0) {
					ans = right;
					break;
				} else {
					right++;
				}
			}
			while (left < 0 && right < arr.length) {
				if (arr[right] == 0) {
					ans = right;
					break;
				} else {
					right++;
				}
			}
			while (right >= arr.length && left >= 0) {
				if (arr[left] == 0) {
					ans = left;
					break;
				} else {
					left--;
				}
			}
			System.out.println(ans);
		} arr[x] == 0 arr[x] arr x 0 {
			System.out.println(x);
		} System.out.println(x) System.out.println System.out System System.out x {
			int left = x - 1, right = x + 1;
			int ans = Integer.MAX_VALUE;
			while (left >= 0 && right < arr.length) {
				if (arr[left] == 0) {
					ans = left;
					break;
				} else {
					left--;
				}
				if (arr[right] == 0) {
					ans = right;
					break;
				} else {
					right++;
				}
			}
			while (left < 0 && right < arr.length) {
				if (arr[right] == 0) {
					ans = right;
					break;
				} else {
					right++;
				}
			}
			while (right >= arr.length && left >= 0) {
				if (arr[left] == 0) {
					ans = left;
					break;
				} else {
					left--;
				}
			}
			System.out.println(ans);
		} int left = x - 1 left x - 1 x 1 right = x + 1; right x + 1 x 1 int ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE while (left >= 0 && right < arr.length) {
				if (arr[left] == 0) {
					ans = left;
					break;
				} else {
					left--;
				}
				if (arr[right] == 0) {
					ans = right;
					break;
				} else {
					right++;
				}
			} left >= 0 && right < arr.length left >= 0 left 0 right < arr.length right arr.length arr arr.length {
				if (arr[left] == 0) {
					ans = left;
					break;
				} else {
					left--;
				}
				if (arr[right] == 0) {
					ans = right;
					break;
				} else {
					right++;
				}
			} if (arr[left] == 0) {
					ans = left;
					break;
				} else {
					left--;
				} arr[left] == 0 arr[left] arr left 0 {
					ans = left;
					break;
				} ans = left ans left break; {
					left--;
				} left-- left if (arr[right] == 0) {
					ans = right;
					break;
				} else {
					right++;
				} arr[right] == 0 arr[right] arr right 0 {
					ans = right;
					break;
				} ans = right ans right break; {
					right++;
				} right++ right while (left < 0 && right < arr.length) {
				if (arr[right] == 0) {
					ans = right;
					break;
				} else {
					right++;
				}
			} left < 0 && right < arr.length left < 0 left 0 right < arr.length right arr.length arr arr.length {
				if (arr[right] == 0) {
					ans = right;
					break;
				} else {
					right++;
				}
			} if (arr[right] == 0) {
					ans = right;
					break;
				} else {
					right++;
				} arr[right] == 0 arr[right] arr right 0 {
					ans = right;
					break;
				} ans = right ans right break; {
					right++;
				} right++ right while (right >= arr.length && left >= 0) {
				if (arr[left] == 0) {
					ans = left;
					break;
				} else {
					left--;
				}
			} right >= arr.length && left >= 0 right >= arr.length right arr.length arr arr.length left >= 0 left 0 {
				if (arr[left] == 0) {
					ans = left;
					break;
				} else {
					left--;
				}
			} if (arr[left] == 0) {
					ans = left;
					break;
				} else {
					left--;
				} arr[left] == 0 arr[left] arr left 0 {
					ans = left;
					break;
				} ans = left ans left break; {
					left--;
				} left-- left 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 scn = new Scanner(System.in);
		int x = scn.nextInt(), n = scn.nextInt();
		int[] arr = new int[102];
		for (int i = 0; i < n; i++) {
			arr[scn.nextInt()] = 1;
		}
		if (arr[x] == 0) {
			System.out.println(x);
		} else {
			int left = x - 1, right = x + 1;
			int ans = Integer.MAX_VALUE;
			while (left >= 0 && right < arr.length) {
				if (arr[left] == 0) {
					ans = left;
					break;
				} else {
					left--;
				}
				if (arr[right] == 0) {
					ans = right;
					break;
				} else {
					right++;
				}
			}
			while (left < 0 && right < arr.length) {
				if (arr[right] == 0) {
					ans = right;
					break;
				} else {
					right++;
				}
			}
			while (right >= arr.length && left >= 0) {
				if (arr[left] == 0) {
					ans = left;
					break;
				} else {
					left--;
				}
			}
			System.out.println(ans);
		}
	}
} public class Main{
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int x = scn.nextInt(), n = scn.nextInt();
		int[] arr = new int[102];
		for (int i = 0; i < n; i++) {
			arr[scn.nextInt()] = 1;
		}
		if (arr[x] == 0) {
			System.out.println(x);
		} else {
			int left = x - 1, right = x + 1;
			int ans = Integer.MAX_VALUE;
			while (left >= 0 && right < arr.length) {
				if (arr[left] == 0) {
					ans = left;
					break;
				} else {
					left--;
				}
				if (arr[right] == 0) {
					ans = right;
					break;
				} else {
					right++;
				}
			}
			while (left < 0 && right < arr.length) {
				if (arr[right] == 0) {
					ans = right;
					break;
				} else {
					right++;
				}
			}
			while (right >= arr.length && left >= 0) {
				if (arr[left] == 0) {
					ans = left;
					break;
				} else {
					left--;
				}
			}
			System.out.println(ans);
		}
	}
} Main
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int x = scn.nextInt(), n = scn.nextInt();
		int[] arr = new int[102];
		for (int i = 0; i < n; i++) {
			arr[scn.nextInt()] = 1;
		}
		if (arr[x] == 0) {
			System.out.println(x);
		} else {
			int left = x - 1, right = x + 1;
			int ans = Integer.MAX_VALUE;
			while (left >= 0 && right < arr.length) {
				if (arr[left] == 0) {
					ans = left;
					break;
				} else {
					left--;
				}
				if (arr[right] == 0) {
					ans = right;
					break;
				} else {
					right++;
				}
			}
			while (left < 0 && right < arr.length) {
				if (arr[right] == 0) {
					ans = right;
					break;
				} else {
					right++;
				}
			}
			while (right >= arr.length && left >= 0) {
				if (arr[left] == 0) {
					ans = left;
					break;
				} else {
					left--;
				}
			}
			System.out.println(ans);
		}
	}
}
