import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();
		int n = sc.nextInt();
		int[] array = new int[n];
		int[] d = new int[102];
		for(int i=0; i<d.length; i++) {
			d[i] = i;
		}
		for(int i=0; i<array.length; i++) {
			array[i] = sc.nextInt();
			d[array[i]] = -1;
		}

		int min = 9999;
		int result = 0;

		if(n == 0) {
			 result = x;
		}
		for(int i=0; i<102; i++) {
			if(d[i] != -1) {
				if(Math.abs(x - i) < min) {
					result = i;
					min = Math.abs(x - i);
				}
			}
		}

		System.out.println(result);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();
		int n = sc.nextInt();
		int[] array = new int[n];
		int[] d = new int[102];
		for(int i=0; i<d.length; i++) {
			d[i] = i;
		}
		for(int i=0; i<array.length; i++) {
			array[i] = sc.nextInt();
			d[array[i]] = -1;
		}

		int min = 9999;
		int result = 0;

		if(n == 0) {
			 result = x;
		}
		for(int i=0; i<102; i++) {
			if(d[i] != -1) {
				if(Math.abs(x - i) < min) {
					result = i;
					min = Math.abs(x - i);
				}
			}
		}

		System.out.println(result);
	}
} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();
		int n = sc.nextInt();
		int[] array = new int[n];
		int[] d = new int[102];
		for(int i=0; i<d.length; i++) {
			d[i] = i;
		}
		for(int i=0; i<array.length; i++) {
			array[i] = sc.nextInt();
			d[array[i]] = -1;
		}

		int min = 9999;
		int result = 0;

		if(n == 0) {
			 result = x;
		}
		for(int i=0; i<102; i++) {
			if(d[i] != -1) {
				if(Math.abs(x - i) < min) {
					result = i;
					min = Math.abs(x - i);
				}
			}
		}

		System.out.println(result);
	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();
		int n = sc.nextInt();
		int[] array = new int[n];
		int[] d = new int[102];
		for(int i=0; i<d.length; i++) {
			d[i] = i;
		}
		for(int i=0; i<array.length; i++) {
			array[i] = sc.nextInt();
			d[array[i]] = -1;
		}

		int min = 9999;
		int result = 0;

		if(n == 0) {
			 result = x;
		}
		for(int i=0; i<102; i++) {
			if(d[i] != -1) {
				if(Math.abs(x - i) < min) {
					result = i;
					min = Math.abs(x - i);
				}
			}
		}

		System.out.println(result);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] array = new int[n]; array new int[n] n int[] d = new int[102]; d new int[102] 102 for(int i=0; i<d.length; i++) {
			d[i] = i;
		} int i=0; int i=0; i 0 i<d.length i d.length d d.length i++ i++ i {
			d[i] = i;
		} {
			d[i] = i;
		} d[i] = i d[i] d i i for(int i=0; i<array.length; i++) {
			array[i] = sc.nextInt();
			d[array[i]] = -1;
		} int i=0; int i=0; i 0 i<array.length i array.length array array.length i++ i++ i {
			array[i] = sc.nextInt();
			d[array[i]] = -1;
		} {
			array[i] = sc.nextInt();
			d[array[i]] = -1;
		} array[i] = sc.nextInt() array[i] array i sc.nextInt() sc.nextInt sc d[array[i]] = -1 d[array[i]] d array[i] array i -1 1 int min = 9999; min 9999 int result = 0; result 0 if(n == 0) {
			 result = x;
		} n == 0 n 0 {
			 result = x;
		} result = x result x for(int i=0; i<102; i++) {
			if(d[i] != -1) {
				if(Math.abs(x - i) < min) {
					result = i;
					min = Math.abs(x - i);
				}
			}
		} int i=0; int i=0; i 0 i<102 i 102 i++ i++ i {
			if(d[i] != -1) {
				if(Math.abs(x - i) < min) {
					result = i;
					min = Math.abs(x - i);
				}
			}
		} {
			if(d[i] != -1) {
				if(Math.abs(x - i) < min) {
					result = i;
					min = Math.abs(x - i);
				}
			}
		} if(d[i] != -1) {
				if(Math.abs(x - i) < min) {
					result = i;
					min = Math.abs(x - i);
				}
			} d[i] != -1 d[i] d i -1 1 {
				if(Math.abs(x - i) < min) {
					result = i;
					min = Math.abs(x - i);
				}
			} if(Math.abs(x - i) < min) {
					result = i;
					min = Math.abs(x - i);
				} Math.abs(x - i) < min Math.abs(x - i) Math.abs Math x - i x i min {
					result = i;
					min = Math.abs(x - i);
				} result = i result i min = Math.abs(x - i) min Math.abs(x - i) Math.abs Math x - i x i System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();
		int n = sc.nextInt();
		int[] array = new int[n];
		int[] d = new int[102];
		for(int i=0; i<d.length; i++) {
			d[i] = i;
		}
		for(int i=0; i<array.length; i++) {
			array[i] = sc.nextInt();
			d[array[i]] = -1;
		}

		int min = 9999;
		int result = 0;

		if(n == 0) {
			 result = x;
		}
		for(int i=0; i<102; i++) {
			if(d[i] != -1) {
				if(Math.abs(x - i) < min) {
					result = i;
					min = Math.abs(x - i);
				}
			}
		}

		System.out.println(result);
	}
} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();
		int n = sc.nextInt();
		int[] array = new int[n];
		int[] d = new int[102];
		for(int i=0; i<d.length; i++) {
			d[i] = i;
		}
		for(int i=0; i<array.length; i++) {
			array[i] = sc.nextInt();
			d[array[i]] = -1;
		}

		int min = 9999;
		int result = 0;

		if(n == 0) {
			 result = x;
		}
		for(int i=0; i<102; i++) {
			if(d[i] != -1) {
				if(Math.abs(x - i) < min) {
					result = i;
					min = Math.abs(x - i);
				}
			}
		}

		System.out.println(result);
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();
		int n = sc.nextInt();
		int[] array = new int[n];
		int[] d = new int[102];
		for(int i=0; i<d.length; i++) {
			d[i] = i;
		}
		for(int i=0; i<array.length; i++) {
			array[i] = sc.nextInt();
			d[array[i]] = -1;
		}

		int min = 9999;
		int result = 0;

		if(n == 0) {
			 result = x;
		}
		for(int i=0; i<102; i++) {
			if(d[i] != -1) {
				if(Math.abs(x - i) < min) {
					result = i;
					min = Math.abs(x - i);
				}
			}
		}

		System.out.println(result);
	}
}
