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 k = 0;
		int s = 1;
		boolean mini = true;
		boolean large = true;
		int[] p = new int[n];
		if(n == 0) {
			System.out.println(x);
			System.exit(0);
		}
		for(int i = 0; i < p.length; i++) {
			int num = sc.nextInt();
			p[i] = num;
			if(num == x) {
				k += 1;
			}
		}
		if(k == 0) {
			System.out.println(x);
			System.exit(0);
		}
		while(true) {
			int min = x - s;
			int lar = x + s;
			for(int i = 0; i < p.length; i++) {
				if(min == p[i]) {
					mini = false;
				}
				if(lar == p[i]) {
					large = false;
				}
			}
			if(mini == true) {
				System.out.println(min);
				break;
			}
			if(large == true) {
				System.out.println(lar);
				break;
			}
			s++;
			mini = true;
		    large = true;
		}
	}

} 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 k = 0;
		int s = 1;
		boolean mini = true;
		boolean large = true;
		int[] p = new int[n];
		if(n == 0) {
			System.out.println(x);
			System.exit(0);
		}
		for(int i = 0; i < p.length; i++) {
			int num = sc.nextInt();
			p[i] = num;
			if(num == x) {
				k += 1;
			}
		}
		if(k == 0) {
			System.out.println(x);
			System.exit(0);
		}
		while(true) {
			int min = x - s;
			int lar = x + s;
			for(int i = 0; i < p.length; i++) {
				if(min == p[i]) {
					mini = false;
				}
				if(lar == p[i]) {
					large = false;
				}
			}
			if(mini == true) {
				System.out.println(min);
				break;
			}
			if(large == true) {
				System.out.println(lar);
				break;
			}
			s++;
			mini = true;
		    large = true;
		}
	}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		int k = 0;
		int s = 1;
		boolean mini = true;
		boolean large = true;
		int[] p = new int[n];
		if(n == 0) {
			System.out.println(x);
			System.exit(0);
		}
		for(int i = 0; i < p.length; i++) {
			int num = sc.nextInt();
			p[i] = num;
			if(num == x) {
				k += 1;
			}
		}
		if(k == 0) {
			System.out.println(x);
			System.exit(0);
		}
		while(true) {
			int min = x - s;
			int lar = x + s;
			for(int i = 0; i < p.length; i++) {
				if(min == p[i]) {
					mini = false;
				}
				if(lar == p[i]) {
					large = false;
				}
			}
			if(mini == true) {
				System.out.println(min);
				break;
			}
			if(large == true) {
				System.out.println(lar);
				break;
			}
			s++;
			mini = true;
		    large = true;
		}
	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		int k = 0;
		int s = 1;
		boolean mini = true;
		boolean large = true;
		int[] p = new int[n];
		if(n == 0) {
			System.out.println(x);
			System.exit(0);
		}
		for(int i = 0; i < p.length; i++) {
			int num = sc.nextInt();
			p[i] = num;
			if(num == x) {
				k += 1;
			}
		}
		if(k == 0) {
			System.out.println(x);
			System.exit(0);
		}
		while(true) {
			int min = x - s;
			int lar = x + s;
			for(int i = 0; i < p.length; i++) {
				if(min == p[i]) {
					mini = false;
				}
				if(lar == p[i]) {
					large = false;
				}
			}
			if(mini == true) {
				System.out.println(min);
				break;
			}
			if(large == true) {
				System.out.println(lar);
				break;
			}
			s++;
			mini = true;
		    large = true;
		}
	} 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 k = 0; k 0 int s = 1; s 1 boolean mini = true; mini true boolean large = true; large true int[] p = new int[n]; p new int[n] n 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 < p.length; i++) {
			int num = sc.nextInt();
			p[i] = num;
			if(num == x) {
				k += 1;
			}
		} int i = 0; int i = 0; i 0 i < p.length i p.length p p.length i++ i++ i {
			int num = sc.nextInt();
			p[i] = num;
			if(num == x) {
				k += 1;
			}
		} {
			int num = sc.nextInt();
			p[i] = num;
			if(num == x) {
				k += 1;
			}
		} int num = sc.nextInt(); num sc.nextInt() sc.nextInt sc p[i] = num p[i] p i num if(num == x) {
				k += 1;
			} num == x num x {
				k += 1;
			} k += 1 k 1 if(k == 0) {
			System.out.println(x);
			System.exit(0);
		} k == 0 k 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 while(true) {
			int min = x - s;
			int lar = x + s;
			for(int i = 0; i < p.length; i++) {
				if(min == p[i]) {
					mini = false;
				}
				if(lar == p[i]) {
					large = false;
				}
			}
			if(mini == true) {
				System.out.println(min);
				break;
			}
			if(large == true) {
				System.out.println(lar);
				break;
			}
			s++;
			mini = true;
		    large = true;
		} true {
			int min = x - s;
			int lar = x + s;
			for(int i = 0; i < p.length; i++) {
				if(min == p[i]) {
					mini = false;
				}
				if(lar == p[i]) {
					large = false;
				}
			}
			if(mini == true) {
				System.out.println(min);
				break;
			}
			if(large == true) {
				System.out.println(lar);
				break;
			}
			s++;
			mini = true;
		    large = true;
		} int min = x - s; min x - s x s int lar = x + s; lar x + s x s for(int i = 0; i < p.length; i++) {
				if(min == p[i]) {
					mini = false;
				}
				if(lar == p[i]) {
					large = false;
				}
			} int i = 0; int i = 0; i 0 i < p.length i p.length p p.length i++ i++ i {
				if(min == p[i]) {
					mini = false;
				}
				if(lar == p[i]) {
					large = false;
				}
			} {
				if(min == p[i]) {
					mini = false;
				}
				if(lar == p[i]) {
					large = false;
				}
			} if(min == p[i]) {
					mini = false;
				} min == p[i] min p[i] p i {
					mini = false;
				} mini = false mini false if(lar == p[i]) {
					large = false;
				} lar == p[i] lar p[i] p i {
					large = false;
				} large = false large false if(mini == true) {
				System.out.println(min);
				break;
			} mini == true mini true {
				System.out.println(min);
				break;
			} System.out.println(min) System.out.println System.out System System.out min break; if(large == true) {
				System.out.println(lar);
				break;
			} large == true large true {
				System.out.println(lar);
				break;
			} System.out.println(lar) System.out.println System.out System System.out lar break; s++ s mini = true mini true large = true large true 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 k = 0;
		int s = 1;
		boolean mini = true;
		boolean large = true;
		int[] p = new int[n];
		if(n == 0) {
			System.out.println(x);
			System.exit(0);
		}
		for(int i = 0; i < p.length; i++) {
			int num = sc.nextInt();
			p[i] = num;
			if(num == x) {
				k += 1;
			}
		}
		if(k == 0) {
			System.out.println(x);
			System.exit(0);
		}
		while(true) {
			int min = x - s;
			int lar = x + s;
			for(int i = 0; i < p.length; i++) {
				if(min == p[i]) {
					mini = false;
				}
				if(lar == p[i]) {
					large = false;
				}
			}
			if(mini == true) {
				System.out.println(min);
				break;
			}
			if(large == true) {
				System.out.println(lar);
				break;
			}
			s++;
			mini = true;
		    large = true;
		}
	}

} 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 k = 0;
		int s = 1;
		boolean mini = true;
		boolean large = true;
		int[] p = new int[n];
		if(n == 0) {
			System.out.println(x);
			System.exit(0);
		}
		for(int i = 0; i < p.length; i++) {
			int num = sc.nextInt();
			p[i] = num;
			if(num == x) {
				k += 1;
			}
		}
		if(k == 0) {
			System.out.println(x);
			System.exit(0);
		}
		while(true) {
			int min = x - s;
			int lar = x + s;
			for(int i = 0; i < p.length; i++) {
				if(min == p[i]) {
					mini = false;
				}
				if(lar == p[i]) {
					large = false;
				}
			}
			if(mini == true) {
				System.out.println(min);
				break;
			}
			if(large == true) {
				System.out.println(lar);
				break;
			}
			s++;
			mini = true;
		    large = true;
		}
	}

} 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 k = 0;
		int s = 1;
		boolean mini = true;
		boolean large = true;
		int[] p = new int[n];
		if(n == 0) {
			System.out.println(x);
			System.exit(0);
		}
		for(int i = 0; i < p.length; i++) {
			int num = sc.nextInt();
			p[i] = num;
			if(num == x) {
				k += 1;
			}
		}
		if(k == 0) {
			System.out.println(x);
			System.exit(0);
		}
		while(true) {
			int min = x - s;
			int lar = x + s;
			for(int i = 0; i < p.length; i++) {
				if(min == p[i]) {
					mini = false;
				}
				if(lar == p[i]) {
					large = false;
				}
			}
			if(mini == true) {
				System.out.println(min);
				break;
			}
			if(large == true) {
				System.out.println(lar);
				break;
			}
			s++;
			mini = true;
		    large = true;
		}
	}

}