import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        if(n==0){
            System.out.println(x);
            System.exit(0);
        }
        int number[] = new int[201];
        Arrays.fill(number,1);
        for(int i=0;i<n;i++){
            int p = sc.nextInt();
            number[p]=0;
        }
        for(int i=0;i<=200;i++){
            if(x-i <= 0)continue;
            if(x+i > 200)continue;
            if(number[x-i]==1){
                System.out.println(x-i);
                System.exit(0);
            }
            if(number[x+i]==1){
                System.out.println(x+i);
                System.exit(0);
            }
        }
        System.out.println(0);//配列全て0で埋まっている
    }
}

class Monmo {
    
}
 import java.util.*; util.* java import java.io.*; io.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        if(n==0){
            System.out.println(x);
            System.exit(0);
        }
        int number[] = new int[201];
        Arrays.fill(number,1);
        for(int i=0;i<n;i++){
            int p = sc.nextInt();
            number[p]=0;
        }
        for(int i=0;i<=200;i++){
            if(x-i <= 0)continue;
            if(x+i > 200)continue;
            if(number[x-i]==1){
                System.out.println(x-i);
                System.exit(0);
            }
            if(number[x+i]==1){
                System.out.println(x+i);
                System.exit(0);
            }
        }
        System.out.println(0);//配列全て0で埋まっている
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        if(n==0){
            System.out.println(x);
            System.exit(0);
        }
        int number[] = new int[201];
        Arrays.fill(number,1);
        for(int i=0;i<n;i++){
            int p = sc.nextInt();
            number[p]=0;
        }
        for(int i=0;i<=200;i++){
            if(x-i <= 0)continue;
            if(x+i > 200)continue;
            if(number[x-i]==1){
                System.out.println(x-i);
                System.exit(0);
            }
            if(number[x+i]==1){
                System.out.println(x+i);
                System.exit(0);
            }
        }
        System.out.println(0);//配列全て0で埋まっている
    } main {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        if(n==0){
            System.out.println(x);
            System.exit(0);
        }
        int number[] = new int[201];
        Arrays.fill(number,1);
        for(int i=0;i<n;i++){
            int p = sc.nextInt();
            number[p]=0;
        }
        for(int i=0;i<=200;i++){
            if(x-i <= 0)continue;
            if(x+i > 200)continue;
            if(number[x-i]==1){
                System.out.println(x-i);
                System.exit(0);
            }
            if(number[x+i]==1){
                System.out.println(x+i);
                System.exit(0);
            }
        }
        System.out.println(0);//配列全て0で埋まっている
    } 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 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 number[] = new int[201]; number new int[201] 201 Arrays.fill(number,1) Arrays.fill Arrays number 1 for(int i=0;i<n;i++){
            int p = sc.nextInt();
            number[p]=0;
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            int p = sc.nextInt();
            number[p]=0;
        } {
            int p = sc.nextInt();
            number[p]=0;
        } int p = sc.nextInt(); p sc.nextInt() sc.nextInt sc number[p]=0 number[p] number p 0 for(int i=0;i<=200;i++){
            if(x-i <= 0)continue;
            if(x+i > 200)continue;
            if(number[x-i]==1){
                System.out.println(x-i);
                System.exit(0);
            }
            if(number[x+i]==1){
                System.out.println(x+i);
                System.exit(0);
            }
        } int i=0; int i=0; i 0 i<=200 i 200 i++ i++ i {
            if(x-i <= 0)continue;
            if(x+i > 200)continue;
            if(number[x-i]==1){
                System.out.println(x-i);
                System.exit(0);
            }
            if(number[x+i]==1){
                System.out.println(x+i);
                System.exit(0);
            }
        } {
            if(x-i <= 0)continue;
            if(x+i > 200)continue;
            if(number[x-i]==1){
                System.out.println(x-i);
                System.exit(0);
            }
            if(number[x+i]==1){
                System.out.println(x+i);
                System.exit(0);
            }
        } if(x-i <= 0)continue; x-i <= 0 x-i x i 0 continue; if(x+i > 200)continue; x+i > 200 x+i x i 200 continue; if(number[x-i]==1){
                System.out.println(x-i);
                System.exit(0);
            } number[x-i]==1 number[x-i] number x-i x i 1 {
                System.out.println(x-i);
                System.exit(0);
            } System.out.println(x-i) System.out.println System.out System System.out x-i x i System.exit(0) System.exit System 0 if(number[x+i]==1){
                System.out.println(x+i);
                System.exit(0);
            } number[x+i]==1 number[x+i] number x+i x i 1 {
                System.out.println(x+i);
                System.exit(0);
            } System.out.println(x+i) System.out.println System.out System System.out x+i x i System.exit(0) System.exit System 0 System.out.println(0) System.out.println System.out System System.out 0 String[] args args class Monmo {
    
} Monmo public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        if(n==0){
            System.out.println(x);
            System.exit(0);
        }
        int number[] = new int[201];
        Arrays.fill(number,1);
        for(int i=0;i<n;i++){
            int p = sc.nextInt();
            number[p]=0;
        }
        for(int i=0;i<=200;i++){
            if(x-i <= 0)continue;
            if(x+i > 200)continue;
            if(number[x-i]==1){
                System.out.println(x-i);
                System.exit(0);
            }
            if(number[x+i]==1){
                System.out.println(x+i);
                System.exit(0);
            }
        }
        System.out.println(0);//配列全て0で埋まっている
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        if(n==0){
            System.out.println(x);
            System.exit(0);
        }
        int number[] = new int[201];
        Arrays.fill(number,1);
        for(int i=0;i<n;i++){
            int p = sc.nextInt();
            number[p]=0;
        }
        for(int i=0;i<=200;i++){
            if(x-i <= 0)continue;
            if(x+i > 200)continue;
            if(number[x-i]==1){
                System.out.println(x-i);
                System.exit(0);
            }
            if(number[x+i]==1){
                System.out.println(x+i);
                System.exit(0);
            }
        }
        System.out.println(0);//配列全て0で埋まっている
    }
} Main
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        if(n==0){
            System.out.println(x);
            System.exit(0);
        }
        int number[] = new int[201];
        Arrays.fill(number,1);
        for(int i=0;i<n;i++){
            int p = sc.nextInt();
            number[p]=0;
        }
        for(int i=0;i<=200;i++){
            if(x-i <= 0)continue;
            if(x+i > 200)continue;
            if(number[x-i]==1){
                System.out.println(x-i);
                System.exit(0);
            }
            if(number[x+i]==1){
                System.out.println(x+i);
                System.exit(0);
            }
        }
        System.out.println(0);//配列全て0で埋まっている
    }
}

class Monmo {
    
}

