import java.util.Arrays;
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[] p = new int[N];
		int[] np = new int[100-N+2];
		if(N==0) {
			System.out.println(X);
			System.exit(0);
		}
		for(int i=0;i<N;i++) {
			p[i] = sc.nextInt();
		}
		Arrays.sort(p);
		int pc = 0;
		np[0] = 0;
		np[100-N+1] = 101;
		int npc = 1;
		for(int i=0; i<100; i++) {
			if(pc < N && i+1 == p[pc]) {
				pc++;
			}else {
				np[npc] = i+1;
				npc++;
			}
		}
		int res = 100;
		int diff = 100;
		for(int i=np.length-1; i>=0; i--) {
			if(diff>=Math.abs(X-np[i])) {
				res = np[i];
				diff = Math.abs(X-np[i]);
			}
		}
		System.out.println(res);
	}
} import java.util.Arrays; Arrays java.util 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[] p = new int[N];
		int[] np = new int[100-N+2];
		if(N==0) {
			System.out.println(X);
			System.exit(0);
		}
		for(int i=0;i<N;i++) {
			p[i] = sc.nextInt();
		}
		Arrays.sort(p);
		int pc = 0;
		np[0] = 0;
		np[100-N+1] = 101;
		int npc = 1;
		for(int i=0; i<100; i++) {
			if(pc < N && i+1 == p[pc]) {
				pc++;
			}else {
				np[npc] = i+1;
				npc++;
			}
		}
		int res = 100;
		int diff = 100;
		for(int i=np.length-1; i>=0; i--) {
			if(diff>=Math.abs(X-np[i])) {
				res = np[i];
				diff = Math.abs(X-np[i]);
			}
		}
		System.out.println(res);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();
		int[] p = new int[N];
		int[] np = new int[100-N+2];
		if(N==0) {
			System.out.println(X);
			System.exit(0);
		}
		for(int i=0;i<N;i++) {
			p[i] = sc.nextInt();
		}
		Arrays.sort(p);
		int pc = 0;
		np[0] = 0;
		np[100-N+1] = 101;
		int npc = 1;
		for(int i=0; i<100; i++) {
			if(pc < N && i+1 == p[pc]) {
				pc++;
			}else {
				np[npc] = i+1;
				npc++;
			}
		}
		int res = 100;
		int diff = 100;
		for(int i=np.length-1; i>=0; i--) {
			if(diff>=Math.abs(X-np[i])) {
				res = np[i];
				diff = Math.abs(X-np[i]);
			}
		}
		System.out.println(res);
	} main {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();
		int[] p = new int[N];
		int[] np = new int[100-N+2];
		if(N==0) {
			System.out.println(X);
			System.exit(0);
		}
		for(int i=0;i<N;i++) {
			p[i] = sc.nextInt();
		}
		Arrays.sort(p);
		int pc = 0;
		np[0] = 0;
		np[100-N+1] = 101;
		int npc = 1;
		for(int i=0; i<100; i++) {
			if(pc < N && i+1 == p[pc]) {
				pc++;
			}else {
				np[npc] = i+1;
				npc++;
			}
		}
		int res = 100;
		int diff = 100;
		for(int i=np.length-1; i>=0; i--) {
			if(diff>=Math.abs(X-np[i])) {
				res = np[i];
				diff = Math.abs(X-np[i]);
			}
		}
		System.out.println(res);
	} 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[] p = new int[N]; p new int[N] N int[] np = new int[100-N+2]; np new int[100-N+2] 100-N+2 100-N 100 N 2 if(N==0) {
			System.out.println(X);
			System.exit(0);
		} N==0 N 0 {
			System.out.println(X);
			System.exit(0);
		} System.out.println(X) System.out.println System.out System System.out X System.exit(0) System.exit System 0 for(int i=0;i<N;i++) {
			p[i] = sc.nextInt();
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			p[i] = sc.nextInt();
		} {
			p[i] = sc.nextInt();
		} p[i] = sc.nextInt() p[i] p i sc.nextInt() sc.nextInt sc Arrays.sort(p) Arrays.sort Arrays p int pc = 0; pc 0 np[0] = 0 np[0] np 0 0 np[100-N+1] = 101 np[100-N+1] np 100-N+1 100-N 100 N 1 101 int npc = 1; npc 1 for(int i=0; i<100; i++) {
			if(pc < N && i+1 == p[pc]) {
				pc++;
			}else {
				np[npc] = i+1;
				npc++;
			}
		} int i=0; int i=0; i 0 i<100 i 100 i++ i++ i {
			if(pc < N && i+1 == p[pc]) {
				pc++;
			}else {
				np[npc] = i+1;
				npc++;
			}
		} {
			if(pc < N && i+1 == p[pc]) {
				pc++;
			}else {
				np[npc] = i+1;
				npc++;
			}
		} if(pc < N && i+1 == p[pc]) {
				pc++;
			}else {
				np[npc] = i+1;
				npc++;
			} pc < N && i+1 == p[pc] pc < N pc N i+1 == p[pc] i+1 i 1 p[pc] p pc {
				pc++;
			} pc++ pc {
				np[npc] = i+1;
				npc++;
			} np[npc] = i+1 np[npc] np npc i+1 i 1 npc++ npc int res = 100; res 100 int diff = 100; diff 100 for(int i=np.length-1; i>=0; i--) {
			if(diff>=Math.abs(X-np[i])) {
				res = np[i];
				diff = Math.abs(X-np[i]);
			}
		} int i=np.length-1; int i=np.length-1; i np.length-1 np.length np np.length 1 i>=0 i 0 i-- i-- i {
			if(diff>=Math.abs(X-np[i])) {
				res = np[i];
				diff = Math.abs(X-np[i]);
			}
		} {
			if(diff>=Math.abs(X-np[i])) {
				res = np[i];
				diff = Math.abs(X-np[i]);
			}
		} if(diff>=Math.abs(X-np[i])) {
				res = np[i];
				diff = Math.abs(X-np[i]);
			} diff>=Math.abs(X-np[i]) diff Math.abs(X-np[i]) Math.abs Math X-np[i] X np[i] np i {
				res = np[i];
				diff = Math.abs(X-np[i]);
			} res = np[i] res np[i] np i diff = Math.abs(X-np[i]) diff Math.abs(X-np[i]) Math.abs Math X-np[i] X np[i] np i System.out.println(res) System.out.println System.out System System.out res 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[] p = new int[N];
		int[] np = new int[100-N+2];
		if(N==0) {
			System.out.println(X);
			System.exit(0);
		}
		for(int i=0;i<N;i++) {
			p[i] = sc.nextInt();
		}
		Arrays.sort(p);
		int pc = 0;
		np[0] = 0;
		np[100-N+1] = 101;
		int npc = 1;
		for(int i=0; i<100; i++) {
			if(pc < N && i+1 == p[pc]) {
				pc++;
			}else {
				np[npc] = i+1;
				npc++;
			}
		}
		int res = 100;
		int diff = 100;
		for(int i=np.length-1; i>=0; i--) {
			if(diff>=Math.abs(X-np[i])) {
				res = np[i];
				diff = Math.abs(X-np[i]);
			}
		}
		System.out.println(res);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int N = sc.nextInt();
		int[] p = new int[N];
		int[] np = new int[100-N+2];
		if(N==0) {
			System.out.println(X);
			System.exit(0);
		}
		for(int i=0;i<N;i++) {
			p[i] = sc.nextInt();
		}
		Arrays.sort(p);
		int pc = 0;
		np[0] = 0;
		np[100-N+1] = 101;
		int npc = 1;
		for(int i=0; i<100; i++) {
			if(pc < N && i+1 == p[pc]) {
				pc++;
			}else {
				np[npc] = i+1;
				npc++;
			}
		}
		int res = 100;
		int diff = 100;
		for(int i=np.length-1; i>=0; i--) {
			if(diff>=Math.abs(X-np[i])) {
				res = np[i];
				diff = Math.abs(X-np[i]);
			}
		}
		System.out.println(res);
	}
} Main
import java.util.Arrays;
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[] p = new int[N];
		int[] np = new int[100-N+2];
		if(N==0) {
			System.out.println(X);
			System.exit(0);
		}
		for(int i=0;i<N;i++) {
			p[i] = sc.nextInt();
		}
		Arrays.sort(p);
		int pc = 0;
		np[0] = 0;
		np[100-N+1] = 101;
		int npc = 1;
		for(int i=0; i<100; i++) {
			if(pc < N && i+1 == p[pc]) {
				pc++;
			}else {
				np[npc] = i+1;
				npc++;
			}
		}
		int res = 100;
		int diff = 100;
		for(int i=np.length-1; i>=0; i--) {
			if(diff>=Math.abs(X-np[i])) {
				res = np[i];
				diff = Math.abs(X-np[i]);
			}
		}
		System.out.println(res);
	}
}
