import java.util.Scanner;
//EphSon solution

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x=sc.nextInt();
        int n=sc.nextInt();
        int[] p=new int[n];
        for(int i=0;i<n;i++) {
        	p[i]=sc.nextInt();
        }
        for(int i=0;i<=100;i++) {
        	int num1=x-i,num2=x+i;
        	int count1=0,count2=0;
        	for(int j=0;j<n;j++) {
        		if(p[j]==num1)	count1++;
        		if(p[j]==num2)	count2++;
        	}
        	if(count1==0) {
        		System.out.println(num1);
        		break;
        	}else if(count2==0) {
        		System.out.println(num2);
        		break;
        	}
        }
    }
} import java.util.Scanner; Scanner 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();
        int[] p=new int[n];
        for(int i=0;i<n;i++) {
        	p[i]=sc.nextInt();
        }
        for(int i=0;i<=100;i++) {
        	int num1=x-i,num2=x+i;
        	int count1=0,count2=0;
        	for(int j=0;j<n;j++) {
        		if(p[j]==num1)	count1++;
        		if(p[j]==num2)	count2++;
        	}
        	if(count1==0) {
        		System.out.println(num1);
        		break;
        	}else if(count2==0) {
        		System.out.println(num2);
        		break;
        	}
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x=sc.nextInt();
        int n=sc.nextInt();
        int[] p=new int[n];
        for(int i=0;i<n;i++) {
        	p[i]=sc.nextInt();
        }
        for(int i=0;i<=100;i++) {
        	int num1=x-i,num2=x+i;
        	int count1=0,count2=0;
        	for(int j=0;j<n;j++) {
        		if(p[j]==num1)	count1++;
        		if(p[j]==num2)	count2++;
        	}
        	if(count1==0) {
        		System.out.println(num1);
        		break;
        	}else if(count2==0) {
        		System.out.println(num2);
        		break;
        	}
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int x=sc.nextInt();
        int n=sc.nextInt();
        int[] p=new int[n];
        for(int i=0;i<n;i++) {
        	p[i]=sc.nextInt();
        }
        for(int i=0;i<=100;i++) {
        	int num1=x-i,num2=x+i;
        	int count1=0,count2=0;
        	for(int j=0;j<n;j++) {
        		if(p[j]==num1)	count1++;
        		if(p[j]==num2)	count2++;
        	}
        	if(count1==0) {
        		System.out.println(num1);
        		break;
        	}else if(count2==0) {
        		System.out.println(num2);
        		break;
        	}
        }
    } 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 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 i=0;i<=100;i++) {
        	int num1=x-i,num2=x+i;
        	int count1=0,count2=0;
        	for(int j=0;j<n;j++) {
        		if(p[j]==num1)	count1++;
        		if(p[j]==num2)	count2++;
        	}
        	if(count1==0) {
        		System.out.println(num1);
        		break;
        	}else if(count2==0) {
        		System.out.println(num2);
        		break;
        	}
        } int i=0; int i=0; i 0 i<=100 i 100 i++ i++ i {
        	int num1=x-i,num2=x+i;
        	int count1=0,count2=0;
        	for(int j=0;j<n;j++) {
        		if(p[j]==num1)	count1++;
        		if(p[j]==num2)	count2++;
        	}
        	if(count1==0) {
        		System.out.println(num1);
        		break;
        	}else if(count2==0) {
        		System.out.println(num2);
        		break;
        	}
        } {
        	int num1=x-i,num2=x+i;
        	int count1=0,count2=0;
        	for(int j=0;j<n;j++) {
        		if(p[j]==num1)	count1++;
        		if(p[j]==num2)	count2++;
        	}
        	if(count1==0) {
        		System.out.println(num1);
        		break;
        	}else if(count2==0) {
        		System.out.println(num2);
        		break;
        	}
        } int num1=x-i num1 x-i x i num2=x+i; num2 x+i x i int count1=0 count1 0 count2=0; count2 0 for(int j=0;j<n;j++) {
        		if(p[j]==num1)	count1++;
        		if(p[j]==num2)	count2++;
        	} int j=0; int j=0; j 0 j<n j n j++ j++ j {
        		if(p[j]==num1)	count1++;
        		if(p[j]==num2)	count2++;
        	} {
        		if(p[j]==num1)	count1++;
        		if(p[j]==num2)	count2++;
        	} if(p[j]==num1)	count1++; p[j]==num1 p[j] p j num1 count1++ count1 if(p[j]==num2)	count2++; p[j]==num2 p[j] p j num2 count2++ count2 if(count1==0) {
        		System.out.println(num1);
        		break;
        	}else if(count2==0) {
        		System.out.println(num2);
        		break;
        	} count1==0 count1 0 {
        		System.out.println(num1);
        		break;
        	} System.out.println(num1) System.out.println System.out System System.out num1 break; if(count2==0) {
        		System.out.println(num2);
        		break;
        	} count2==0 count2 0 {
        		System.out.println(num2);
        		break;
        	} System.out.println(num2) System.out.println System.out System System.out num2 break; 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();
        int[] p=new int[n];
        for(int i=0;i<n;i++) {
        	p[i]=sc.nextInt();
        }
        for(int i=0;i<=100;i++) {
        	int num1=x-i,num2=x+i;
        	int count1=0,count2=0;
        	for(int j=0;j<n;j++) {
        		if(p[j]==num1)	count1++;
        		if(p[j]==num2)	count2++;
        	}
        	if(count1==0) {
        		System.out.println(num1);
        		break;
        	}else if(count2==0) {
        		System.out.println(num2);
        		break;
        	}
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x=sc.nextInt();
        int n=sc.nextInt();
        int[] p=new int[n];
        for(int i=0;i<n;i++) {
        	p[i]=sc.nextInt();
        }
        for(int i=0;i<=100;i++) {
        	int num1=x-i,num2=x+i;
        	int count1=0,count2=0;
        	for(int j=0;j<n;j++) {
        		if(p[j]==num1)	count1++;
        		if(p[j]==num2)	count2++;
        	}
        	if(count1==0) {
        		System.out.println(num1);
        		break;
        	}else if(count2==0) {
        		System.out.println(num2);
        		break;
        	}
        }
    }
} Main
import java.util.Scanner;
//EphSon solution

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x=sc.nextInt();
        int n=sc.nextInt();
        int[] p=new int[n];
        for(int i=0;i<n;i++) {
        	p[i]=sc.nextInt();
        }
        for(int i=0;i<=100;i++) {
        	int num1=x-i,num2=x+i;
        	int count1=0,count2=0;
        	for(int j=0;j<n;j++) {
        		if(p[j]==num1)	count1++;
        		if(p[j]==num2)	count2++;
        	}
        	if(count1==0) {
        		System.out.println(num1);
        		break;
        	}else if(count2==0) {
        		System.out.println(num2);
        		break;
        	}
        }
    }
}
