import java.util.*;
 
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();
        int[] p = new int[N];
        int[] ans = new int[202];
        int min = 1000;
        int result = X;
        int j=0;
        for(int i=-100;i<=101;i++){
            ans[j] = Math.abs(X-i);
            j++;
        }
        for(int i=0;i<N;i++){
            int num = sc.nextInt();
            ans[num+100] = 1000;
        }
        for(int i=0;i<ans.length;i++){
            if(min>ans[i])
            {
                min = ans[i];
            }
        }
        result -= min;
        if(ans[result+100]==1000){
            result = X + min;
        }
        if(N==0){
            result = X;
        }
        System.out.println(result);
    }
} import java.util.*; util.* java 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();
        int[] p = new int[N];
        int[] ans = new int[202];
        int min = 1000;
        int result = X;
        int j=0;
        for(int i=-100;i<=101;i++){
            ans[j] = Math.abs(X-i);
            j++;
        }
        for(int i=0;i<N;i++){
            int num = sc.nextInt();
            ans[num+100] = 1000;
        }
        for(int i=0;i<ans.length;i++){
            if(min>ans[i])
            {
                min = ans[i];
            }
        }
        result -= min;
        if(ans[result+100]==1000){
            result = X + min;
        }
        if(N==0){
            result = X;
        }
        System.out.println(result);
    }
} 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();
        int[] p = new int[N];
        int[] ans = new int[202];
        int min = 1000;
        int result = X;
        int j=0;
        for(int i=-100;i<=101;i++){
            ans[j] = Math.abs(X-i);
            j++;
        }
        for(int i=0;i<N;i++){
            int num = sc.nextInt();
            ans[num+100] = 1000;
        }
        for(int i=0;i<ans.length;i++){
            if(min>ans[i])
            {
                min = ans[i];
            }
        }
        result -= min;
        if(ans[result+100]==1000){
            result = X + min;
        }
        if(N==0){
            result = X;
        }
        System.out.println(result);
    } main {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
        int[] p = new int[N];
        int[] ans = new int[202];
        int min = 1000;
        int result = X;
        int j=0;
        for(int i=-100;i<=101;i++){
            ans[j] = Math.abs(X-i);
            j++;
        }
        for(int i=0;i<N;i++){
            int num = sc.nextInt();
            ans[num+100] = 1000;
        }
        for(int i=0;i<ans.length;i++){
            if(min>ans[i])
            {
                min = ans[i];
            }
        }
        result -= min;
        if(ans[result+100]==1000){
            result = X + min;
        }
        if(N==0){
            result = X;
        }
        System.out.println(result);
    } 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 int[] p = new int[N]; p new int[N] N int[] ans = new int[202]; ans new int[202] 202 int min = 1000; min 1000 int result = X; result X int j=0; j 0 for(int i=-100;i<=101;i++){
            ans[j] = Math.abs(X-i);
            j++;
        } int i=-100; int i=-100; i -100 100 i<=101 i 101 i++ i++ i {
            ans[j] = Math.abs(X-i);
            j++;
        } {
            ans[j] = Math.abs(X-i);
            j++;
        } ans[j] = Math.abs(X-i) ans[j] ans j Math.abs(X-i) Math.abs Math X-i X i j++ j for(int i=0;i<N;i++){
            int num = sc.nextInt();
            ans[num+100] = 1000;
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            int num = sc.nextInt();
            ans[num+100] = 1000;
        } {
            int num = sc.nextInt();
            ans[num+100] = 1000;
        } int num = sc.nextInt(); num sc.nextInt() sc.nextInt sc ans[num+100] = 1000 ans[num+100] ans num+100 num 100 1000 for(int i=0;i<ans.length;i++){
            if(min>ans[i])
            {
                min = ans[i];
            }
        } int i=0; int i=0; i 0 i<ans.length i ans.length ans ans.length i++ i++ i {
            if(min>ans[i])
            {
                min = ans[i];
            }
        } {
            if(min>ans[i])
            {
                min = ans[i];
            }
        } if(min>ans[i])
            {
                min = ans[i];
            } min>ans[i] min ans[i] ans i {
                min = ans[i];
            } min = ans[i] min ans[i] ans i result -= min result min if(ans[result+100]==1000){
            result = X + min;
        } ans[result+100]==1000 ans[result+100] ans result+100 result 100 1000 {
            result = X + min;
        } result = X + min result X + min X min if(N==0){
            result = X;
        } N==0 N 0 {
            result = X;
        } result = X result X System.out.println(result) System.out.println System.out System System.out result 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();
        int[] p = new int[N];
        int[] ans = new int[202];
        int min = 1000;
        int result = X;
        int j=0;
        for(int i=-100;i<=101;i++){
            ans[j] = Math.abs(X-i);
            j++;
        }
        for(int i=0;i<N;i++){
            int num = sc.nextInt();
            ans[num+100] = 1000;
        }
        for(int i=0;i<ans.length;i++){
            if(min>ans[i])
            {
                min = ans[i];
            }
        }
        result -= min;
        if(ans[result+100]==1000){
            result = X + min;
        }
        if(N==0){
            result = X;
        }
        System.out.println(result);
    }
} 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();
        int[] p = new int[N];
        int[] ans = new int[202];
        int min = 1000;
        int result = X;
        int j=0;
        for(int i=-100;i<=101;i++){
            ans[j] = Math.abs(X-i);
            j++;
        }
        for(int i=0;i<N;i++){
            int num = sc.nextInt();
            ans[num+100] = 1000;
        }
        for(int i=0;i<ans.length;i++){
            if(min>ans[i])
            {
                min = ans[i];
            }
        }
        result -= min;
        if(ans[result+100]==1000){
            result = X + min;
        }
        if(N==0){
            result = X;
        }
        System.out.println(result);
    }
} Main
import java.util.*;
 
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();
        int[] p = new int[N];
        int[] ans = new int[202];
        int min = 1000;
        int result = X;
        int j=0;
        for(int i=-100;i<=101;i++){
            ans[j] = Math.abs(X-i);
            j++;
        }
        for(int i=0;i<N;i++){
            int num = sc.nextInt();
            ans[num+100] = 1000;
        }
        for(int i=0;i<ans.length;i++){
            if(min>ans[i])
            {
                min = ans[i];
            }
        }
        result -= min;
        if(ans[result+100]==1000){
            result = X + min;
        }
        if(N==0){
            result = X;
        }
        System.out.println(result);
    }
}