import java.util.*;
import java.lang.Math;
public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();;
        int N = sc.nextInt();
        List<Integer> list = new ArrayList<>();
        int notcon = 101;
        int notcon2 = 101;
        for(int i = 0;i < N;i++){
            list.add(sc.nextInt());
        }
        int Forbidden = X;
        for(int i = 0;i < 100;i++){
            if(!list.contains(Forbidden)){
                //int notcon = X;
                notcon = Forbidden;
                //System.out.println(notcon + "j");
                //System.out.println(notcon);
                break;
            }
            Forbidden++;
        }
        int Forbidden2 = X - 1;
        for(int i = 0;i < 100;i++){
            if(!list.contains(Forbidden2)){
                notcon2 = Forbidden2;
                //System.out.println(notcon2 + "g");
                break;
            }
            Forbidden2--;
        }
        if(list == null || list.size() == 0){
            System.out.println(X);
        }else if(Math.abs(notcon - X) < Math.abs(notcon2 - X)){
            System.out.println(notcon);
        }else if(Math.abs(notcon - X) > Math.abs(notcon2 - X)){
            System.out.println(notcon2);
        }else if(notcon < notcon2){
            System.out.println(notcon);
        }else if(notcon2 < notcon){
            System.out.println(notcon2);
        }
    }
} import java.util.*; util.* java import java.lang.Math; Math java.lang public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();;
        int N = sc.nextInt();
        List<Integer> list = new ArrayList<>();
        int notcon = 101;
        int notcon2 = 101;
        for(int i = 0;i < N;i++){
            list.add(sc.nextInt());
        }
        int Forbidden = X;
        for(int i = 0;i < 100;i++){
            if(!list.contains(Forbidden)){
                //int notcon = X;
                notcon = Forbidden;
                //System.out.println(notcon + "j");
                //System.out.println(notcon);
                break;
            }
            Forbidden++;
        }
        int Forbidden2 = X - 1;
        for(int i = 0;i < 100;i++){
            if(!list.contains(Forbidden2)){
                notcon2 = Forbidden2;
                //System.out.println(notcon2 + "g");
                break;
            }
            Forbidden2--;
        }
        if(list == null || list.size() == 0){
            System.out.println(X);
        }else if(Math.abs(notcon - X) < Math.abs(notcon2 - X)){
            System.out.println(notcon);
        }else if(Math.abs(notcon - X) > Math.abs(notcon2 - X)){
            System.out.println(notcon2);
        }else if(notcon < notcon2){
            System.out.println(notcon);
        }else if(notcon2 < notcon){
            System.out.println(notcon2);
        }
    }
} Main public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();;
        int N = sc.nextInt();
        List<Integer> list = new ArrayList<>();
        int notcon = 101;
        int notcon2 = 101;
        for(int i = 0;i < N;i++){
            list.add(sc.nextInt());
        }
        int Forbidden = X;
        for(int i = 0;i < 100;i++){
            if(!list.contains(Forbidden)){
                //int notcon = X;
                notcon = Forbidden;
                //System.out.println(notcon + "j");
                //System.out.println(notcon);
                break;
            }
            Forbidden++;
        }
        int Forbidden2 = X - 1;
        for(int i = 0;i < 100;i++){
            if(!list.contains(Forbidden2)){
                notcon2 = Forbidden2;
                //System.out.println(notcon2 + "g");
                break;
            }
            Forbidden2--;
        }
        if(list == null || list.size() == 0){
            System.out.println(X);
        }else if(Math.abs(notcon - X) < Math.abs(notcon2 - X)){
            System.out.println(notcon);
        }else if(Math.abs(notcon - X) > Math.abs(notcon2 - X)){
            System.out.println(notcon2);
        }else if(notcon < notcon2){
            System.out.println(notcon);
        }else if(notcon2 < notcon){
            System.out.println(notcon2);
        }
    } main {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();;
        int N = sc.nextInt();
        List<Integer> list = new ArrayList<>();
        int notcon = 101;
        int notcon2 = 101;
        for(int i = 0;i < N;i++){
            list.add(sc.nextInt());
        }
        int Forbidden = X;
        for(int i = 0;i < 100;i++){
            if(!list.contains(Forbidden)){
                //int notcon = X;
                notcon = Forbidden;
                //System.out.println(notcon + "j");
                //System.out.println(notcon);
                break;
            }
            Forbidden++;
        }
        int Forbidden2 = X - 1;
        for(int i = 0;i < 100;i++){
            if(!list.contains(Forbidden2)){
                notcon2 = Forbidden2;
                //System.out.println(notcon2 + "g");
                break;
            }
            Forbidden2--;
        }
        if(list == null || list.size() == 0){
            System.out.println(X);
        }else if(Math.abs(notcon - X) < Math.abs(notcon2 - X)){
            System.out.println(notcon);
        }else if(Math.abs(notcon - X) > Math.abs(notcon2 - X)){
            System.out.println(notcon2);
        }else if(notcon < notcon2){
            System.out.println(notcon);
        }else if(notcon2 < notcon){
            System.out.println(notcon2);
        }
    } 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 List<Integer> list = new ArrayList<>(); list new ArrayList<>() int notcon = 101; notcon 101 int notcon2 = 101; notcon2 101 for(int i = 0;i < N;i++){
            list.add(sc.nextInt());
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            list.add(sc.nextInt());
        } {
            list.add(sc.nextInt());
        } list.add(sc.nextInt()) list.add list sc.nextInt() sc.nextInt sc int Forbidden = X; Forbidden X for(int i = 0;i < 100;i++){
            if(!list.contains(Forbidden)){
                //int notcon = X;
                notcon = Forbidden;
                //System.out.println(notcon + "j");
                //System.out.println(notcon);
                break;
            }
            Forbidden++;
        } int i = 0; int i = 0; i 0 i < 100 i 100 i++ i++ i {
            if(!list.contains(Forbidden)){
                //int notcon = X;
                notcon = Forbidden;
                //System.out.println(notcon + "j");
                //System.out.println(notcon);
                break;
            }
            Forbidden++;
        } {
            if(!list.contains(Forbidden)){
                //int notcon = X;
                notcon = Forbidden;
                //System.out.println(notcon + "j");
                //System.out.println(notcon);
                break;
            }
            Forbidden++;
        } if(!list.contains(Forbidden)){
                //int notcon = X;
                notcon = Forbidden;
                //System.out.println(notcon + "j");
                //System.out.println(notcon);
                break;
            } !list.contains(Forbidden) list.contains(Forbidden) list.contains list Forbidden {
                //int notcon = X;
                notcon = Forbidden;
                //System.out.println(notcon + "j");
                //System.out.println(notcon);
                break;
            } notcon = Forbidden notcon Forbidden break; Forbidden++ Forbidden int Forbidden2 = X - 1; Forbidden2 X - 1 X 1 for(int i = 0;i < 100;i++){
            if(!list.contains(Forbidden2)){
                notcon2 = Forbidden2;
                //System.out.println(notcon2 + "g");
                break;
            }
            Forbidden2--;
        } int i = 0; int i = 0; i 0 i < 100 i 100 i++ i++ i {
            if(!list.contains(Forbidden2)){
                notcon2 = Forbidden2;
                //System.out.println(notcon2 + "g");
                break;
            }
            Forbidden2--;
        } {
            if(!list.contains(Forbidden2)){
                notcon2 = Forbidden2;
                //System.out.println(notcon2 + "g");
                break;
            }
            Forbidden2--;
        } if(!list.contains(Forbidden2)){
                notcon2 = Forbidden2;
                //System.out.println(notcon2 + "g");
                break;
            } !list.contains(Forbidden2) list.contains(Forbidden2) list.contains list Forbidden2 {
                notcon2 = Forbidden2;
                //System.out.println(notcon2 + "g");
                break;
            } notcon2 = Forbidden2 notcon2 Forbidden2 break; Forbidden2-- Forbidden2 if(list == null || list.size() == 0){
            System.out.println(X);
        }else if(Math.abs(notcon - X) < Math.abs(notcon2 - X)){
            System.out.println(notcon);
        }else if(Math.abs(notcon - X) > Math.abs(notcon2 - X)){
            System.out.println(notcon2);
        }else if(notcon < notcon2){
            System.out.println(notcon);
        }else if(notcon2 < notcon){
            System.out.println(notcon2);
        } list == null || list.size() == 0 list == null list null list.size() == 0 list.size() list.size list 0 {
            System.out.println(X);
        } System.out.println(X) System.out.println System.out System System.out X if(Math.abs(notcon - X) < Math.abs(notcon2 - X)){
            System.out.println(notcon);
        }else if(Math.abs(notcon - X) > Math.abs(notcon2 - X)){
            System.out.println(notcon2);
        }else if(notcon < notcon2){
            System.out.println(notcon);
        }else if(notcon2 < notcon){
            System.out.println(notcon2);
        } Math.abs(notcon - X) < Math.abs(notcon2 - X) Math.abs(notcon - X) Math.abs Math notcon - X notcon X Math.abs(notcon2 - X) Math.abs Math notcon2 - X notcon2 X {
            System.out.println(notcon);
        } System.out.println(notcon) System.out.println System.out System System.out notcon if(Math.abs(notcon - X) > Math.abs(notcon2 - X)){
            System.out.println(notcon2);
        }else if(notcon < notcon2){
            System.out.println(notcon);
        }else if(notcon2 < notcon){
            System.out.println(notcon2);
        } Math.abs(notcon - X) > Math.abs(notcon2 - X) Math.abs(notcon - X) Math.abs Math notcon - X notcon X Math.abs(notcon2 - X) Math.abs Math notcon2 - X notcon2 X {
            System.out.println(notcon2);
        } System.out.println(notcon2) System.out.println System.out System System.out notcon2 if(notcon < notcon2){
            System.out.println(notcon);
        }else if(notcon2 < notcon){
            System.out.println(notcon2);
        } notcon < notcon2 notcon notcon2 {
            System.out.println(notcon);
        } System.out.println(notcon) System.out.println System.out System System.out notcon if(notcon2 < notcon){
            System.out.println(notcon2);
        } notcon2 < notcon notcon2 notcon {
            System.out.println(notcon2);
        } System.out.println(notcon2) System.out.println System.out System System.out notcon2 String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();;
        int N = sc.nextInt();
        List<Integer> list = new ArrayList<>();
        int notcon = 101;
        int notcon2 = 101;
        for(int i = 0;i < N;i++){
            list.add(sc.nextInt());
        }
        int Forbidden = X;
        for(int i = 0;i < 100;i++){
            if(!list.contains(Forbidden)){
                //int notcon = X;
                notcon = Forbidden;
                //System.out.println(notcon + "j");
                //System.out.println(notcon);
                break;
            }
            Forbidden++;
        }
        int Forbidden2 = X - 1;
        for(int i = 0;i < 100;i++){
            if(!list.contains(Forbidden2)){
                notcon2 = Forbidden2;
                //System.out.println(notcon2 + "g");
                break;
            }
            Forbidden2--;
        }
        if(list == null || list.size() == 0){
            System.out.println(X);
        }else if(Math.abs(notcon - X) < Math.abs(notcon2 - X)){
            System.out.println(notcon);
        }else if(Math.abs(notcon - X) > Math.abs(notcon2 - X)){
            System.out.println(notcon2);
        }else if(notcon < notcon2){
            System.out.println(notcon);
        }else if(notcon2 < notcon){
            System.out.println(notcon2);
        }
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();;
        int N = sc.nextInt();
        List<Integer> list = new ArrayList<>();
        int notcon = 101;
        int notcon2 = 101;
        for(int i = 0;i < N;i++){
            list.add(sc.nextInt());
        }
        int Forbidden = X;
        for(int i = 0;i < 100;i++){
            if(!list.contains(Forbidden)){
                //int notcon = X;
                notcon = Forbidden;
                //System.out.println(notcon + "j");
                //System.out.println(notcon);
                break;
            }
            Forbidden++;
        }
        int Forbidden2 = X - 1;
        for(int i = 0;i < 100;i++){
            if(!list.contains(Forbidden2)){
                notcon2 = Forbidden2;
                //System.out.println(notcon2 + "g");
                break;
            }
            Forbidden2--;
        }
        if(list == null || list.size() == 0){
            System.out.println(X);
        }else if(Math.abs(notcon - X) < Math.abs(notcon2 - X)){
            System.out.println(notcon);
        }else if(Math.abs(notcon - X) > Math.abs(notcon2 - X)){
            System.out.println(notcon2);
        }else if(notcon < notcon2){
            System.out.println(notcon);
        }else if(notcon2 < notcon){
            System.out.println(notcon2);
        }
    }
} Main
import java.util.*;
import java.lang.Math;
public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();;
        int N = sc.nextInt();
        List<Integer> list = new ArrayList<>();
        int notcon = 101;
        int notcon2 = 101;
        for(int i = 0;i < N;i++){
            list.add(sc.nextInt());
        }
        int Forbidden = X;
        for(int i = 0;i < 100;i++){
            if(!list.contains(Forbidden)){
                //int notcon = X;
                notcon = Forbidden;
                //System.out.println(notcon + "j");
                //System.out.println(notcon);
                break;
            }
            Forbidden++;
        }
        int Forbidden2 = X - 1;
        for(int i = 0;i < 100;i++){
            if(!list.contains(Forbidden2)){
                notcon2 = Forbidden2;
                //System.out.println(notcon2 + "g");
                break;
            }
            Forbidden2--;
        }
        if(list == null || list.size() == 0){
            System.out.println(X);
        }else if(Math.abs(notcon - X) < Math.abs(notcon2 - X)){
            System.out.println(notcon);
        }else if(Math.abs(notcon - X) > Math.abs(notcon2 - X)){
            System.out.println(notcon2);
        }else if(notcon < notcon2){
            System.out.println(notcon);
        }else if(notcon2 < notcon){
            System.out.println(notcon2);
        }
    }
}
