import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		int[] numberInfo =  new int[102];
		for(int i=0;i <n;i ++) {
			numberInfo[sc.nextInt()]++;
		}
		if(numberInfo[x] ==0) {
			System.out.println(x);
			return;
		}
		int right = 0;
		for(int i =x+1; i <=101;i++) {
			if(numberInfo[i] ==0) {
				right = i;
				break;
			}
		}
		int left = 0;
		for(int i =x-1; i >=0;i--) {
			if(numberInfo[i] ==0) {
				left = i;
				break;
			}
		}
		if((right -x) >= (x - left)) {
			System.out.println(left);
		}else {
			System.out.println(right);
		}

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		int[] numberInfo =  new int[102];
		for(int i=0;i <n;i ++) {
			numberInfo[sc.nextInt()]++;
		}
		if(numberInfo[x] ==0) {
			System.out.println(x);
			return;
		}
		int right = 0;
		for(int i =x+1; i <=101;i++) {
			if(numberInfo[i] ==0) {
				right = i;
				break;
			}
		}
		int left = 0;
		for(int i =x-1; i >=0;i--) {
			if(numberInfo[i] ==0) {
				left = i;
				break;
			}
		}
		if((right -x) >= (x - left)) {
			System.out.println(left);
		}else {
			System.out.println(right);
		}

	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		int[] numberInfo =  new int[102];
		for(int i=0;i <n;i ++) {
			numberInfo[sc.nextInt()]++;
		}
		if(numberInfo[x] ==0) {
			System.out.println(x);
			return;
		}
		int right = 0;
		for(int i =x+1; i <=101;i++) {
			if(numberInfo[i] ==0) {
				right = i;
				break;
			}
		}
		int left = 0;
		for(int i =x-1; i >=0;i--) {
			if(numberInfo[i] ==0) {
				left = i;
				break;
			}
		}
		if((right -x) >= (x - left)) {
			System.out.println(left);
		}else {
			System.out.println(right);
		}

	} main {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		int[] numberInfo =  new int[102];
		for(int i=0;i <n;i ++) {
			numberInfo[sc.nextInt()]++;
		}
		if(numberInfo[x] ==0) {
			System.out.println(x);
			return;
		}
		int right = 0;
		for(int i =x+1; i <=101;i++) {
			if(numberInfo[i] ==0) {
				right = i;
				break;
			}
		}
		int left = 0;
		for(int i =x-1; i >=0;i--) {
			if(numberInfo[i] ==0) {
				left = i;
				break;
			}
		}
		if((right -x) >= (x - left)) {
			System.out.println(left);
		}else {
			System.out.println(right);
		}

	} 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[] numberInfo =  new int[102]; numberInfo new int[102] 102 for(int i=0;i <n;i ++) {
			numberInfo[sc.nextInt()]++;
		} int i=0; int i=0; i 0 i <n i n i ++ i ++ i {
			numberInfo[sc.nextInt()]++;
		} {
			numberInfo[sc.nextInt()]++;
		} numberInfo[sc.nextInt()]++ numberInfo[sc.nextInt()] numberInfo sc.nextInt() sc.nextInt sc if(numberInfo[x] ==0) {
			System.out.println(x);
			return;
		} numberInfo[x] ==0 numberInfo[x] numberInfo x 0 {
			System.out.println(x);
			return;
		} System.out.println(x) System.out.println System.out System System.out x return; int right = 0; right 0 for(int i =x+1; i <=101;i++) {
			if(numberInfo[i] ==0) {
				right = i;
				break;
			}
		} int i =x+1; int i =x+1; i x+1 x 1 i <=101 i 101 i++ i++ i {
			if(numberInfo[i] ==0) {
				right = i;
				break;
			}
		} {
			if(numberInfo[i] ==0) {
				right = i;
				break;
			}
		} if(numberInfo[i] ==0) {
				right = i;
				break;
			} numberInfo[i] ==0 numberInfo[i] numberInfo i 0 {
				right = i;
				break;
			} right = i right i break; int left = 0; left 0 for(int i =x-1; i >=0;i--) {
			if(numberInfo[i] ==0) {
				left = i;
				break;
			}
		} int i =x-1; int i =x-1; i x-1 x 1 i >=0 i 0 i-- i-- i {
			if(numberInfo[i] ==0) {
				left = i;
				break;
			}
		} {
			if(numberInfo[i] ==0) {
				left = i;
				break;
			}
		} if(numberInfo[i] ==0) {
				left = i;
				break;
			} numberInfo[i] ==0 numberInfo[i] numberInfo i 0 {
				left = i;
				break;
			} left = i left i break; if((right -x) >= (x - left)) {
			System.out.println(left);
		}else {
			System.out.println(right);
		} (right -x) >= (x - left) (right -x) right x (x - left) x left {
			System.out.println(left);
		} System.out.println(left) System.out.println System.out System System.out left {
			System.out.println(right);
		} System.out.println(right) System.out.println System.out System System.out right String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		int[] numberInfo =  new int[102];
		for(int i=0;i <n;i ++) {
			numberInfo[sc.nextInt()]++;
		}
		if(numberInfo[x] ==0) {
			System.out.println(x);
			return;
		}
		int right = 0;
		for(int i =x+1; i <=101;i++) {
			if(numberInfo[i] ==0) {
				right = i;
				break;
			}
		}
		int left = 0;
		for(int i =x-1; i >=0;i--) {
			if(numberInfo[i] ==0) {
				left = i;
				break;
			}
		}
		if((right -x) >= (x - left)) {
			System.out.println(left);
		}else {
			System.out.println(right);
		}

	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		int[] numberInfo =  new int[102];
		for(int i=0;i <n;i ++) {
			numberInfo[sc.nextInt()]++;
		}
		if(numberInfo[x] ==0) {
			System.out.println(x);
			return;
		}
		int right = 0;
		for(int i =x+1; i <=101;i++) {
			if(numberInfo[i] ==0) {
				right = i;
				break;
			}
		}
		int left = 0;
		for(int i =x-1; i >=0;i--) {
			if(numberInfo[i] ==0) {
				left = i;
				break;
			}
		}
		if((right -x) >= (x - left)) {
			System.out.println(left);
		}else {
			System.out.println(right);
		}

	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		int[] numberInfo =  new int[102];
		for(int i=0;i <n;i ++) {
			numberInfo[sc.nextInt()]++;
		}
		if(numberInfo[x] ==0) {
			System.out.println(x);
			return;
		}
		int right = 0;
		for(int i =x+1; i <=101;i++) {
			if(numberInfo[i] ==0) {
				right = i;
				break;
			}
		}
		int left = 0;
		for(int i =x-1; i >=0;i--) {
			if(numberInfo[i] ==0) {
				left = i;
				break;
			}
		}
		if((right -x) >= (x - left)) {
			System.out.println(left);
		}else {
			System.out.println(right);
		}

	}
}