import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		int n = scan.nextInt();
		int[] p = new int[n];
		int ans = x;
		if(n == 0) {
			System.out.println(x);
			System.exit(0);
		}
		int count = 0;
		for(int i=0;i<n;i++) {
			p[i] = scan.nextInt();
		}
		
		for(int j=0;j<=100;j++) {
			boolean b = true;
			for(int k=0;k<n;k++) {
				if(ans == p[k]) {
					b = false;
				}
			}
			if(b) {
				System.out.println(ans);
				System.exit(0);
			}
			if(j % 2 == 0) {
				ans -= j+1;
			}else {
				ans += j+1;
			}
		}

	}

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

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		int n = scan.nextInt();
		int[] p = new int[n];
		int ans = x;
		if(n == 0) {
			System.out.println(x);
			System.exit(0);
		}
		int count = 0;
		for(int i=0;i<n;i++) {
			p[i] = scan.nextInt();
		}
		
		for(int j=0;j<=100;j++) {
			boolean b = true;
			for(int k=0;k<n;k++) {
				if(ans == p[k]) {
					b = false;
				}
			}
			if(b) {
				System.out.println(ans);
				System.exit(0);
			}
			if(j % 2 == 0) {
				ans -= j+1;
			}else {
				ans += j+1;
			}
		}

	}

} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		int n = scan.nextInt();
		int[] p = new int[n];
		int ans = x;
		if(n == 0) {
			System.out.println(x);
			System.exit(0);
		}
		int count = 0;
		for(int i=0;i<n;i++) {
			p[i] = scan.nextInt();
		}
		
		for(int j=0;j<=100;j++) {
			boolean b = true;
			for(int k=0;k<n;k++) {
				if(ans == p[k]) {
					b = false;
				}
			}
			if(b) {
				System.out.println(ans);
				System.exit(0);
			}
			if(j % 2 == 0) {
				ans -= j+1;
			}else {
				ans += j+1;
			}
		}

	} main {
		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		int n = scan.nextInt();
		int[] p = new int[n];
		int ans = x;
		if(n == 0) {
			System.out.println(x);
			System.exit(0);
		}
		int count = 0;
		for(int i=0;i<n;i++) {
			p[i] = scan.nextInt();
		}
		
		for(int j=0;j<=100;j++) {
			boolean b = true;
			for(int k=0;k<n;k++) {
				if(ans == p[k]) {
					b = false;
				}
			}
			if(b) {
				System.out.println(ans);
				System.exit(0);
			}
			if(j % 2 == 0) {
				ans -= j+1;
			}else {
				ans += j+1;
			}
		}

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int x = scan.nextInt(); x scan.nextInt() scan.nextInt scan int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int[] p = new int[n]; p new int[n] n int ans = x; ans x 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 int count = 0; count 0 for(int i=0;i<n;i++) {
			p[i] = scan.nextInt();
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			p[i] = scan.nextInt();
		} {
			p[i] = scan.nextInt();
		} p[i] = scan.nextInt() p[i] p i scan.nextInt() scan.nextInt scan for(int j=0;j<=100;j++) {
			boolean b = true;
			for(int k=0;k<n;k++) {
				if(ans == p[k]) {
					b = false;
				}
			}
			if(b) {
				System.out.println(ans);
				System.exit(0);
			}
			if(j % 2 == 0) {
				ans -= j+1;
			}else {
				ans += j+1;
			}
		} int j=0; int j=0; j 0 j<=100 j 100 j++ j++ j {
			boolean b = true;
			for(int k=0;k<n;k++) {
				if(ans == p[k]) {
					b = false;
				}
			}
			if(b) {
				System.out.println(ans);
				System.exit(0);
			}
			if(j % 2 == 0) {
				ans -= j+1;
			}else {
				ans += j+1;
			}
		} {
			boolean b = true;
			for(int k=0;k<n;k++) {
				if(ans == p[k]) {
					b = false;
				}
			}
			if(b) {
				System.out.println(ans);
				System.exit(0);
			}
			if(j % 2 == 0) {
				ans -= j+1;
			}else {
				ans += j+1;
			}
		} boolean b = true; b true for(int k=0;k<n;k++) {
				if(ans == p[k]) {
					b = false;
				}
			} int k=0; int k=0; k 0 k<n k n k++ k++ k {
				if(ans == p[k]) {
					b = false;
				}
			} {
				if(ans == p[k]) {
					b = false;
				}
			} if(ans == p[k]) {
					b = false;
				} ans == p[k] ans p[k] p k {
					b = false;
				} b = false b false if(b) {
				System.out.println(ans);
				System.exit(0);
			} b {
				System.out.println(ans);
				System.exit(0);
			} System.out.println(ans) System.out.println System.out System System.out ans System.exit(0) System.exit System 0 if(j % 2 == 0) {
				ans -= j+1;
			}else {
				ans += j+1;
			} j % 2 == 0 j % 2 j 2 0 {
				ans -= j+1;
			} ans -= j+1 ans j+1 j 1 {
				ans += j+1;
			} ans += j+1 ans j+1 j 1 String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		int n = scan.nextInt();
		int[] p = new int[n];
		int ans = x;
		if(n == 0) {
			System.out.println(x);
			System.exit(0);
		}
		int count = 0;
		for(int i=0;i<n;i++) {
			p[i] = scan.nextInt();
		}
		
		for(int j=0;j<=100;j++) {
			boolean b = true;
			for(int k=0;k<n;k++) {
				if(ans == p[k]) {
					b = false;
				}
			}
			if(b) {
				System.out.println(ans);
				System.exit(0);
			}
			if(j % 2 == 0) {
				ans -= j+1;
			}else {
				ans += j+1;
			}
		}

	}

} public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		int n = scan.nextInt();
		int[] p = new int[n];
		int ans = x;
		if(n == 0) {
			System.out.println(x);
			System.exit(0);
		}
		int count = 0;
		for(int i=0;i<n;i++) {
			p[i] = scan.nextInt();
		}
		
		for(int j=0;j<=100;j++) {
			boolean b = true;
			for(int k=0;k<n;k++) {
				if(ans == p[k]) {
					b = false;
				}
			}
			if(b) {
				System.out.println(ans);
				System.exit(0);
			}
			if(j % 2 == 0) {
				ans -= j+1;
			}else {
				ans += j+1;
			}
		}

	}

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

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		int n = scan.nextInt();
		int[] p = new int[n];
		int ans = x;
		if(n == 0) {
			System.out.println(x);
			System.exit(0);
		}
		int count = 0;
		for(int i=0;i<n;i++) {
			p[i] = scan.nextInt();
		}
		
		for(int j=0;j<=100;j++) {
			boolean b = true;
			for(int k=0;k<n;k++) {
				if(ans == p[k]) {
					b = false;
				}
			}
			if(b) {
				System.out.println(ans);
				System.exit(0);
			}
			if(j % 2 == 0) {
				ans -= j+1;
			}else {
				ans += j+1;
			}
		}

	}

}