import java.io.*;
import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;

public class Main
{	
	public static void main(String []args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		
		//long X=Long.parseLong(br.readLine());
		String []s=br.readLine().split(" ");
		/*long X=Long.parseLong(s[0]);
		long N=Long.parseLong(s[1]);
		long C=Long.parseLong(s[2]);
		long K=Long.parseLong(s[3]);*/
		int X=Integer.parseInt(s[0]);
		int N=Integer.parseInt(s[1]);
		
		
		
		/*int a[][]=new int[N+1][N+1]; //you can use a set instead of array
		int ht[]=new int[N+1];
		boolean flag=false;*/
		//String ans="";
		
		int ans=0, mindiff=Integer.MAX_VALUE, diff=0;
		
		HashSet<Integer> h= new HashSet<Integer>();
		s=br.readLine().split(" ");
		
		for(int i=0;i<N;i++)
			h.add(Integer.parseInt(s[i]));
			
		for(int i=0;i<=101;i++)
		{
			if(!h.contains(i))
			{
				diff= abs(X-i);
				if(diff<mindiff)
				{
					mindiff=diff;
					ans=i;
				}
			}
		}
		
			//ans = flag==true? "Yes" : "No";
		
		out.println(ans);
		
	}
	
	
}

 import java.io.*; io.* java import java.util.*; util.* java import static java.lang.System.*; import static java.lang.System.*; import static java.lang.System.*; import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.Math.*; public class Main
{	
	public static void main(String []args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		
		//long X=Long.parseLong(br.readLine());
		String []s=br.readLine().split(" ");
		/*long X=Long.parseLong(s[0]);
		long N=Long.parseLong(s[1]);
		long C=Long.parseLong(s[2]);
		long K=Long.parseLong(s[3]);*/
		int X=Integer.parseInt(s[0]);
		int N=Integer.parseInt(s[1]);
		
		
		
		/*int a[][]=new int[N+1][N+1]; //you can use a set instead of array
		int ht[]=new int[N+1];
		boolean flag=false;*/
		//String ans="";
		
		int ans=0, mindiff=Integer.MAX_VALUE, diff=0;
		
		HashSet<Integer> h= new HashSet<Integer>();
		s=br.readLine().split(" ");
		
		for(int i=0;i<N;i++)
			h.add(Integer.parseInt(s[i]));
			
		for(int i=0;i<=101;i++)
		{
			if(!h.contains(i))
			{
				diff= abs(X-i);
				if(diff<mindiff)
				{
					mindiff=diff;
					ans=i;
				}
			}
		}
		
			//ans = flag==true? "Yes" : "No";
		
		out.println(ans);
		
	}
	
	
} Main public static void main(String []args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		
		//long X=Long.parseLong(br.readLine());
		String []s=br.readLine().split(" ");
		/*long X=Long.parseLong(s[0]);
		long N=Long.parseLong(s[1]);
		long C=Long.parseLong(s[2]);
		long K=Long.parseLong(s[3]);*/
		int X=Integer.parseInt(s[0]);
		int N=Integer.parseInt(s[1]);
		
		
		
		/*int a[][]=new int[N+1][N+1]; //you can use a set instead of array
		int ht[]=new int[N+1];
		boolean flag=false;*/
		//String ans="";
		
		int ans=0, mindiff=Integer.MAX_VALUE, diff=0;
		
		HashSet<Integer> h= new HashSet<Integer>();
		s=br.readLine().split(" ");
		
		for(int i=0;i<N;i++)
			h.add(Integer.parseInt(s[i]));
			
		for(int i=0;i<=101;i++)
		{
			if(!h.contains(i))
			{
				diff= abs(X-i);
				if(diff<mindiff)
				{
					mindiff=diff;
					ans=i;
				}
			}
		}
		
			//ans = flag==true? "Yes" : "No";
		
		out.println(ans);
		
	} main {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		
		//long X=Long.parseLong(br.readLine());
		String []s=br.readLine().split(" ");
		/*long X=Long.parseLong(s[0]);
		long N=Long.parseLong(s[1]);
		long C=Long.parseLong(s[2]);
		long K=Long.parseLong(s[3]);*/
		int X=Integer.parseInt(s[0]);
		int N=Integer.parseInt(s[1]);
		
		
		
		/*int a[][]=new int[N+1][N+1]; //you can use a set instead of array
		int ht[]=new int[N+1];
		boolean flag=false;*/
		//String ans="";
		
		int ans=0, mindiff=Integer.MAX_VALUE, diff=0;
		
		HashSet<Integer> h= new HashSet<Integer>();
		s=br.readLine().split(" ");
		
		for(int i=0;i<N;i++)
			h.add(Integer.parseInt(s[i]));
			
		for(int i=0;i<=101;i++)
		{
			if(!h.contains(i))
			{
				diff= abs(X-i);
				if(diff<mindiff)
				{
					mindiff=diff;
					ans=i;
				}
			}
		}
		
			//ans = flag==true? "Yes" : "No";
		
		out.println(ans);
		
	} BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String []s=br.readLine().split(" "); s br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int X=Integer.parseInt(s[0]); X Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 int N=Integer.parseInt(s[1]); N Integer.parseInt(s[1]) Integer.parseInt Integer s[1] s 1 int ans=0 ans 0 mindiff=Integer.MAX_VALUE mindiff Integer.MAX_VALUE Integer Integer.MAX_VALUE diff=0; diff 0 HashSet<Integer> h= new HashSet<Integer>(); h new HashSet<Integer>() s=br.readLine().split(" ") s br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for(int i=0;i<N;i++)
			h.add(Integer.parseInt(s[i])); int i=0; int i=0; i 0 i<N i N i++ i++ i h.add(Integer.parseInt(s[i])); h.add(Integer.parseInt(s[i])) h.add h Integer.parseInt(s[i]) Integer.parseInt Integer s[i] s i for(int i=0;i<=101;i++)
		{
			if(!h.contains(i))
			{
				diff= abs(X-i);
				if(diff<mindiff)
				{
					mindiff=diff;
					ans=i;
				}
			}
		} int i=0; int i=0; i 0 i<=101 i 101 i++ i++ i {
			if(!h.contains(i))
			{
				diff= abs(X-i);
				if(diff<mindiff)
				{
					mindiff=diff;
					ans=i;
				}
			}
		} {
			if(!h.contains(i))
			{
				diff= abs(X-i);
				if(diff<mindiff)
				{
					mindiff=diff;
					ans=i;
				}
			}
		} if(!h.contains(i))
			{
				diff= abs(X-i);
				if(diff<mindiff)
				{
					mindiff=diff;
					ans=i;
				}
			} !h.contains(i) h.contains(i) h.contains h i {
				diff= abs(X-i);
				if(diff<mindiff)
				{
					mindiff=diff;
					ans=i;
				}
			} diff= abs(X-i) diff abs(X-i) abs X-i X i if(diff<mindiff)
				{
					mindiff=diff;
					ans=i;
				} diff<mindiff diff mindiff {
					mindiff=diff;
					ans=i;
				} mindiff=diff mindiff diff ans=i ans i out.println(ans) out.println out ans String []args args public class Main
{	
	public static void main(String []args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		
		//long X=Long.parseLong(br.readLine());
		String []s=br.readLine().split(" ");
		/*long X=Long.parseLong(s[0]);
		long N=Long.parseLong(s[1]);
		long C=Long.parseLong(s[2]);
		long K=Long.parseLong(s[3]);*/
		int X=Integer.parseInt(s[0]);
		int N=Integer.parseInt(s[1]);
		
		
		
		/*int a[][]=new int[N+1][N+1]; //you can use a set instead of array
		int ht[]=new int[N+1];
		boolean flag=false;*/
		//String ans="";
		
		int ans=0, mindiff=Integer.MAX_VALUE, diff=0;
		
		HashSet<Integer> h= new HashSet<Integer>();
		s=br.readLine().split(" ");
		
		for(int i=0;i<N;i++)
			h.add(Integer.parseInt(s[i]));
			
		for(int i=0;i<=101;i++)
		{
			if(!h.contains(i))
			{
				diff= abs(X-i);
				if(diff<mindiff)
				{
					mindiff=diff;
					ans=i;
				}
			}
		}
		
			//ans = flag==true? "Yes" : "No";
		
		out.println(ans);
		
	}
	
	
} public class Main
{	
	public static void main(String []args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		
		//long X=Long.parseLong(br.readLine());
		String []s=br.readLine().split(" ");
		/*long X=Long.parseLong(s[0]);
		long N=Long.parseLong(s[1]);
		long C=Long.parseLong(s[2]);
		long K=Long.parseLong(s[3]);*/
		int X=Integer.parseInt(s[0]);
		int N=Integer.parseInt(s[1]);
		
		
		
		/*int a[][]=new int[N+1][N+1]; //you can use a set instead of array
		int ht[]=new int[N+1];
		boolean flag=false;*/
		//String ans="";
		
		int ans=0, mindiff=Integer.MAX_VALUE, diff=0;
		
		HashSet<Integer> h= new HashSet<Integer>();
		s=br.readLine().split(" ");
		
		for(int i=0;i<N;i++)
			h.add(Integer.parseInt(s[i]));
			
		for(int i=0;i<=101;i++)
		{
			if(!h.contains(i))
			{
				diff= abs(X-i);
				if(diff<mindiff)
				{
					mindiff=diff;
					ans=i;
				}
			}
		}
		
			//ans = flag==true? "Yes" : "No";
		
		out.println(ans);
		
	}
	
	
} Main
import java.io.*;
import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;

public class Main
{	
	public static void main(String []args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		
		//long X=Long.parseLong(br.readLine());
		String []s=br.readLine().split(" ");
		/*long X=Long.parseLong(s[0]);
		long N=Long.parseLong(s[1]);
		long C=Long.parseLong(s[2]);
		long K=Long.parseLong(s[3]);*/
		int X=Integer.parseInt(s[0]);
		int N=Integer.parseInt(s[1]);
		
		
		
		/*int a[][]=new int[N+1][N+1]; //you can use a set instead of array
		int ht[]=new int[N+1];
		boolean flag=false;*/
		//String ans="";
		
		int ans=0, mindiff=Integer.MAX_VALUE, diff=0;
		
		HashSet<Integer> h= new HashSet<Integer>();
		s=br.readLine().split(" ");
		
		for(int i=0;i<N;i++)
			h.add(Integer.parseInt(s[i]));
			
		for(int i=0;i<=101;i++)
		{
			if(!h.contains(i))
			{
				diff= abs(X-i);
				if(diff<mindiff)
				{
					mindiff=diff;
					ans=i;
				}
			}
		}
		
			//ans = flag==true? "Yes" : "No";
		
		out.println(ans);
		
	}
	
	
}


