import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
        boolean flag=false;
        if(N==0) {
            System.out.println(X);
            flag=true;
        }else {
            Set<Integer> nums = new HashSet<Integer>();
            for(int i=0; i<N; i++) {
                nums.add(sc.nextInt());
            }

            for(int i=0; i<Math.min(X,101-X)+1;i++) {
                if(!nums.contains(X-i)) {
                    System.out.println(X-i);
                    flag=true;
                    break;
                }else if(!nums.contains(X+i)){
                    System.out.println(X+i);
                    flag=true;
                    break;
                }
            }
            if(!flag) {
                if(X<=50) {
                    System.out.println(0);
                }else {
                    System.out.println(101);
                }
            }

        }
	}

} import java.util.HashSet; HashSet java.util import java.util.Scanner; Scanner java.util import java.util.Set; Set 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();
        boolean flag=false;
        if(N==0) {
            System.out.println(X);
            flag=true;
        }else {
            Set<Integer> nums = new HashSet<Integer>();
            for(int i=0; i<N; i++) {
                nums.add(sc.nextInt());
            }

            for(int i=0; i<Math.min(X,101-X)+1;i++) {
                if(!nums.contains(X-i)) {
                    System.out.println(X-i);
                    flag=true;
                    break;
                }else if(!nums.contains(X+i)){
                    System.out.println(X+i);
                    flag=true;
                    break;
                }
            }
            if(!flag) {
                if(X<=50) {
                    System.out.println(0);
                }else {
                    System.out.println(101);
                }
            }

        }
	}

} Main public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
        boolean flag=false;
        if(N==0) {
            System.out.println(X);
            flag=true;
        }else {
            Set<Integer> nums = new HashSet<Integer>();
            for(int i=0; i<N; i++) {
                nums.add(sc.nextInt());
            }

            for(int i=0; i<Math.min(X,101-X)+1;i++) {
                if(!nums.contains(X-i)) {
                    System.out.println(X-i);
                    flag=true;
                    break;
                }else if(!nums.contains(X+i)){
                    System.out.println(X+i);
                    flag=true;
                    break;
                }
            }
            if(!flag) {
                if(X<=50) {
                    System.out.println(0);
                }else {
                    System.out.println(101);
                }
            }

        }
	} main {
	    Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
        boolean flag=false;
        if(N==0) {
            System.out.println(X);
            flag=true;
        }else {
            Set<Integer> nums = new HashSet<Integer>();
            for(int i=0; i<N; i++) {
                nums.add(sc.nextInt());
            }

            for(int i=0; i<Math.min(X,101-X)+1;i++) {
                if(!nums.contains(X-i)) {
                    System.out.println(X-i);
                    flag=true;
                    break;
                }else if(!nums.contains(X+i)){
                    System.out.println(X+i);
                    flag=true;
                    break;
                }
            }
            if(!flag) {
                if(X<=50) {
                    System.out.println(0);
                }else {
                    System.out.println(101);
                }
            }

        }
	} 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 boolean flag=false; flag false if(N==0) {
            System.out.println(X);
            flag=true;
        }else {
            Set<Integer> nums = new HashSet<Integer>();
            for(int i=0; i<N; i++) {
                nums.add(sc.nextInt());
            }

            for(int i=0; i<Math.min(X,101-X)+1;i++) {
                if(!nums.contains(X-i)) {
                    System.out.println(X-i);
                    flag=true;
                    break;
                }else if(!nums.contains(X+i)){
                    System.out.println(X+i);
                    flag=true;
                    break;
                }
            }
            if(!flag) {
                if(X<=50) {
                    System.out.println(0);
                }else {
                    System.out.println(101);
                }
            }

        } N==0 N 0 {
            System.out.println(X);
            flag=true;
        } System.out.println(X) System.out.println System.out System System.out X flag=true flag true {
            Set<Integer> nums = new HashSet<Integer>();
            for(int i=0; i<N; i++) {
                nums.add(sc.nextInt());
            }

            for(int i=0; i<Math.min(X,101-X)+1;i++) {
                if(!nums.contains(X-i)) {
                    System.out.println(X-i);
                    flag=true;
                    break;
                }else if(!nums.contains(X+i)){
                    System.out.println(X+i);
                    flag=true;
                    break;
                }
            }
            if(!flag) {
                if(X<=50) {
                    System.out.println(0);
                }else {
                    System.out.println(101);
                }
            }

        } Set<Integer> nums = new HashSet<Integer>(); nums new HashSet<Integer>() for(int i=0; i<N; i++) {
                nums.add(sc.nextInt());
            } int i=0; int i=0; i 0 i<N i N i++ i++ i {
                nums.add(sc.nextInt());
            } {
                nums.add(sc.nextInt());
            } nums.add(sc.nextInt()) nums.add nums sc.nextInt() sc.nextInt sc for(int i=0; i<Math.min(X,101-X)+1;i++) {
                if(!nums.contains(X-i)) {
                    System.out.println(X-i);
                    flag=true;
                    break;
                }else if(!nums.contains(X+i)){
                    System.out.println(X+i);
                    flag=true;
                    break;
                }
            } int i=0; int i=0; i 0 i<Math.min(X,101-X)+1 i Math.min(X,101-X)+1 Math.min(X,101-X) Math.min Math X 101-X 101 X 1 i++ i++ i {
                if(!nums.contains(X-i)) {
                    System.out.println(X-i);
                    flag=true;
                    break;
                }else if(!nums.contains(X+i)){
                    System.out.println(X+i);
                    flag=true;
                    break;
                }
            } {
                if(!nums.contains(X-i)) {
                    System.out.println(X-i);
                    flag=true;
                    break;
                }else if(!nums.contains(X+i)){
                    System.out.println(X+i);
                    flag=true;
                    break;
                }
            } if(!nums.contains(X-i)) {
                    System.out.println(X-i);
                    flag=true;
                    break;
                }else if(!nums.contains(X+i)){
                    System.out.println(X+i);
                    flag=true;
                    break;
                } !nums.contains(X-i) nums.contains(X-i) nums.contains nums X-i X i {
                    System.out.println(X-i);
                    flag=true;
                    break;
                } System.out.println(X-i) System.out.println System.out System System.out X-i X i flag=true flag true break; if(!nums.contains(X+i)){
                    System.out.println(X+i);
                    flag=true;
                    break;
                } !nums.contains(X+i) nums.contains(X+i) nums.contains nums X+i X i {
                    System.out.println(X+i);
                    flag=true;
                    break;
                } System.out.println(X+i) System.out.println System.out System System.out X+i X i flag=true flag true break; if(!flag) {
                if(X<=50) {
                    System.out.println(0);
                }else {
                    System.out.println(101);
                }
            } !flag flag {
                if(X<=50) {
                    System.out.println(0);
                }else {
                    System.out.println(101);
                }
            } if(X<=50) {
                    System.out.println(0);
                }else {
                    System.out.println(101);
                } X<=50 X 50 {
                    System.out.println(0);
                } System.out.println(0) System.out.println System.out System System.out 0 {
                    System.out.println(101);
                } System.out.println(101) System.out.println System.out System System.out 101 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();
        boolean flag=false;
        if(N==0) {
            System.out.println(X);
            flag=true;
        }else {
            Set<Integer> nums = new HashSet<Integer>();
            for(int i=0; i<N; i++) {
                nums.add(sc.nextInt());
            }

            for(int i=0; i<Math.min(X,101-X)+1;i++) {
                if(!nums.contains(X-i)) {
                    System.out.println(X-i);
                    flag=true;
                    break;
                }else if(!nums.contains(X+i)){
                    System.out.println(X+i);
                    flag=true;
                    break;
                }
            }
            if(!flag) {
                if(X<=50) {
                    System.out.println(0);
                }else {
                    System.out.println(101);
                }
            }

        }
	}

} public class Main {

	public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
        boolean flag=false;
        if(N==0) {
            System.out.println(X);
            flag=true;
        }else {
            Set<Integer> nums = new HashSet<Integer>();
            for(int i=0; i<N; i++) {
                nums.add(sc.nextInt());
            }

            for(int i=0; i<Math.min(X,101-X)+1;i++) {
                if(!nums.contains(X-i)) {
                    System.out.println(X-i);
                    flag=true;
                    break;
                }else if(!nums.contains(X+i)){
                    System.out.println(X+i);
                    flag=true;
                    break;
                }
            }
            if(!flag) {
                if(X<=50) {
                    System.out.println(0);
                }else {
                    System.out.println(101);
                }
            }

        }
	}

} Main
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
        boolean flag=false;
        if(N==0) {
            System.out.println(X);
            flag=true;
        }else {
            Set<Integer> nums = new HashSet<Integer>();
            for(int i=0; i<N; i++) {
                nums.add(sc.nextInt());
            }

            for(int i=0; i<Math.min(X,101-X)+1;i++) {
                if(!nums.contains(X-i)) {
                    System.out.println(X-i);
                    flag=true;
                    break;
                }else if(!nums.contains(X+i)){
                    System.out.println(X+i);
                    flag=true;
                    break;
                }
            }
            if(!flag) {
                if(X<=50) {
                    System.out.println(0);
                }else {
                    System.out.println(101);
                }
            }

        }
	}

}
