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

public class Main{
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String[] cmd=br.readLine().split(" ");
		int x=Integer.valueOf(cmd[0]);
		int n=Integer.valueOf(cmd[1]);
		int[] arr=new int[200];
		cmd=br.readLine().split(" ");
		for(int i=0;i<n;i++)
		{
			arr[Integer.valueOf(cmd[i])]=1;
		}
		int len=0;
		int ans=-1;
		while(true)
		{
			int a=x-len;
			int b=x+len;
			if(arr[a]==0)
			{
				ans=a;
				break;
			}
			if(arr[b]==0)
			{
				ans=b;
				break;
			}
			len++;
		}
		System.out.println(ans);
	}

} import java.util.*; util.* java import java.io.*; io.* java public class Main{
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String[] cmd=br.readLine().split(" ");
		int x=Integer.valueOf(cmd[0]);
		int n=Integer.valueOf(cmd[1]);
		int[] arr=new int[200];
		cmd=br.readLine().split(" ");
		for(int i=0;i<n;i++)
		{
			arr[Integer.valueOf(cmd[i])]=1;
		}
		int len=0;
		int ans=-1;
		while(true)
		{
			int a=x-len;
			int b=x+len;
			if(arr[a]==0)
			{
				ans=a;
				break;
			}
			if(arr[b]==0)
			{
				ans=b;
				break;
			}
			len++;
		}
		System.out.println(ans);
	}

} Main public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String[] cmd=br.readLine().split(" ");
		int x=Integer.valueOf(cmd[0]);
		int n=Integer.valueOf(cmd[1]);
		int[] arr=new int[200];
		cmd=br.readLine().split(" ");
		for(int i=0;i<n;i++)
		{
			arr[Integer.valueOf(cmd[i])]=1;
		}
		int len=0;
		int ans=-1;
		while(true)
		{
			int a=x-len;
			int b=x+len;
			if(arr[a]==0)
			{
				ans=a;
				break;
			}
			if(arr[b]==0)
			{
				ans=b;
				break;
			}
			len++;
		}
		System.out.println(ans);
	} main {
		// TODO Auto-generated method stub
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String[] cmd=br.readLine().split(" ");
		int x=Integer.valueOf(cmd[0]);
		int n=Integer.valueOf(cmd[1]);
		int[] arr=new int[200];
		cmd=br.readLine().split(" ");
		for(int i=0;i<n;i++)
		{
			arr[Integer.valueOf(cmd[i])]=1;
		}
		int len=0;
		int ans=-1;
		while(true)
		{
			int a=x-len;
			int b=x+len;
			if(arr[a]==0)
			{
				ans=a;
				break;
			}
			if(arr[b]==0)
			{
				ans=b;
				break;
			}
			len++;
		}
		System.out.println(ans);
	} BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] cmd=br.readLine().split(" "); cmd br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int x=Integer.valueOf(cmd[0]); x Integer.valueOf(cmd[0]) Integer.valueOf Integer cmd[0] cmd 0 int n=Integer.valueOf(cmd[1]); n Integer.valueOf(cmd[1]) Integer.valueOf Integer cmd[1] cmd 1 int[] arr=new int[200]; arr new int[200] 200 cmd=br.readLine().split(" ") cmd br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for(int i=0;i<n;i++)
		{
			arr[Integer.valueOf(cmd[i])]=1;
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			arr[Integer.valueOf(cmd[i])]=1;
		} {
			arr[Integer.valueOf(cmd[i])]=1;
		} arr[Integer.valueOf(cmd[i])]=1 arr[Integer.valueOf(cmd[i])] arr Integer.valueOf(cmd[i]) Integer.valueOf Integer cmd[i] cmd i 1 int len=0; len 0 int ans=-1; ans -1 1 while(true)
		{
			int a=x-len;
			int b=x+len;
			if(arr[a]==0)
			{
				ans=a;
				break;
			}
			if(arr[b]==0)
			{
				ans=b;
				break;
			}
			len++;
		} true {
			int a=x-len;
			int b=x+len;
			if(arr[a]==0)
			{
				ans=a;
				break;
			}
			if(arr[b]==0)
			{
				ans=b;
				break;
			}
			len++;
		} int a=x-len; a x-len x len int b=x+len; b x+len x len if(arr[a]==0)
			{
				ans=a;
				break;
			} arr[a]==0 arr[a] arr a 0 {
				ans=a;
				break;
			} ans=a ans a break; if(arr[b]==0)
			{
				ans=b;
				break;
			} arr[b]==0 arr[b] arr b 0 {
				ans=b;
				break;
			} ans=b ans b break; len++ len System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main{
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String[] cmd=br.readLine().split(" ");
		int x=Integer.valueOf(cmd[0]);
		int n=Integer.valueOf(cmd[1]);
		int[] arr=new int[200];
		cmd=br.readLine().split(" ");
		for(int i=0;i<n;i++)
		{
			arr[Integer.valueOf(cmd[i])]=1;
		}
		int len=0;
		int ans=-1;
		while(true)
		{
			int a=x-len;
			int b=x+len;
			if(arr[a]==0)
			{
				ans=a;
				break;
			}
			if(arr[b]==0)
			{
				ans=b;
				break;
			}
			len++;
		}
		System.out.println(ans);
	}

} public class Main{
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String[] cmd=br.readLine().split(" ");
		int x=Integer.valueOf(cmd[0]);
		int n=Integer.valueOf(cmd[1]);
		int[] arr=new int[200];
		cmd=br.readLine().split(" ");
		for(int i=0;i<n;i++)
		{
			arr[Integer.valueOf(cmd[i])]=1;
		}
		int len=0;
		int ans=-1;
		while(true)
		{
			int a=x-len;
			int b=x+len;
			if(arr[a]==0)
			{
				ans=a;
				break;
			}
			if(arr[b]==0)
			{
				ans=b;
				break;
			}
			len++;
		}
		System.out.println(ans);
	}

} Main

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

public class Main{
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String[] cmd=br.readLine().split(" ");
		int x=Integer.valueOf(cmd[0]);
		int n=Integer.valueOf(cmd[1]);
		int[] arr=new int[200];
		cmd=br.readLine().split(" ");
		for(int i=0;i<n;i++)
		{
			arr[Integer.valueOf(cmd[i])]=1;
		}
		int len=0;
		int ans=-1;
		while(true)
		{
			int a=x-len;
			int b=x+len;
			if(arr[a]==0)
			{
				ans=a;
				break;
			}
			if(arr[b]==0)
			{
				ans=b;
				break;
			}
			len++;
		}
		System.out.println(ans);
	}

}
