import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        Integer[] p = new Integer[n];
        for(int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}
		for(int a = 0; a < 1000; a++) {
			if(!(Arrays.asList(p).contains(x - a))){
			System.out.println(x - a);
			return;
			}
			else if(!(Arrays.asList(p).contains(x + a))){
			System.out.println(x + a);
			return;
			}
		}
	}
} import java.util.*; util.* java import java.lang.*; lang.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        Integer[] p = new Integer[n];
        for(int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}
		for(int a = 0; a < 1000; a++) {
			if(!(Arrays.asList(p).contains(x - a))){
			System.out.println(x - a);
			return;
			}
			else if(!(Arrays.asList(p).contains(x + a))){
			System.out.println(x + a);
			return;
			}
		}
	}
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        Integer[] p = new Integer[n];
        for(int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}
		for(int a = 0; a < 1000; a++) {
			if(!(Arrays.asList(p).contains(x - a))){
			System.out.println(x - a);
			return;
			}
			else if(!(Arrays.asList(p).contains(x + a))){
			System.out.println(x + a);
			return;
			}
		}
	} main {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        Integer[] p = new Integer[n];
        for(int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}
		for(int a = 0; a < 1000; a++) {
			if(!(Arrays.asList(p).contains(x - a))){
			System.out.println(x - a);
			return;
			}
			else if(!(Arrays.asList(p).contains(x + a))){
			System.out.println(x + a);
			return;
			}
		}
	} 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 Integer[] p = new Integer[n]; p new Integer[n] n 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 for(int a = 0; a < 1000; a++) {
			if(!(Arrays.asList(p).contains(x - a))){
			System.out.println(x - a);
			return;
			}
			else if(!(Arrays.asList(p).contains(x + a))){
			System.out.println(x + a);
			return;
			}
		} int a = 0; int a = 0; a 0 a < 1000 a 1000 a++ a++ a {
			if(!(Arrays.asList(p).contains(x - a))){
			System.out.println(x - a);
			return;
			}
			else if(!(Arrays.asList(p).contains(x + a))){
			System.out.println(x + a);
			return;
			}
		} {
			if(!(Arrays.asList(p).contains(x - a))){
			System.out.println(x - a);
			return;
			}
			else if(!(Arrays.asList(p).contains(x + a))){
			System.out.println(x + a);
			return;
			}
		} if(!(Arrays.asList(p).contains(x - a))){
			System.out.println(x - a);
			return;
			}
			else if(!(Arrays.asList(p).contains(x + a))){
			System.out.println(x + a);
			return;
			} !(Arrays.asList(p).contains(x - a)) (Arrays.asList(p).contains(x - a)) Arrays.asList(p).contains Arrays.asList(p) Arrays.asList Arrays p x - a x a {
			System.out.println(x - a);
			return;
			} System.out.println(x - a) System.out.println System.out System System.out x - a x a return; if(!(Arrays.asList(p).contains(x + a))){
			System.out.println(x + a);
			return;
			} !(Arrays.asList(p).contains(x + a)) (Arrays.asList(p).contains(x + a)) Arrays.asList(p).contains Arrays.asList(p) Arrays.asList Arrays p x + a x a {
			System.out.println(x + a);
			return;
			} System.out.println(x + a) System.out.println System.out System System.out x + a x a return; 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();
        Integer[] p = new Integer[n];
        for(int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}
		for(int a = 0; a < 1000; a++) {
			if(!(Arrays.asList(p).contains(x - a))){
			System.out.println(x - a);
			return;
			}
			else if(!(Arrays.asList(p).contains(x + a))){
			System.out.println(x + a);
			return;
			}
		}
	}
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        Integer[] p = new Integer[n];
        for(int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}
		for(int a = 0; a < 1000; a++) {
			if(!(Arrays.asList(p).contains(x - a))){
			System.out.println(x - a);
			return;
			}
			else if(!(Arrays.asList(p).contains(x + a))){
			System.out.println(x + a);
			return;
			}
		}
	}
} Main
import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        Integer[] p = new Integer[n];
        for(int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}
		for(int a = 0; a < 1000; a++) {
			if(!(Arrays.asList(p).contains(x - a))){
			System.out.println(x - a);
			return;
			}
			else if(!(Arrays.asList(p).contains(x + a))){
			System.out.println(x + a);
			return;
			}
		}
	}
}