import java.util.Scanner;

public class Main
{

	public static void main(String args[])
	{

		int count = 0;
		int temp = 0;

		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();
		}
		sc.close();

		for(int i = 0; i < n; i++)
		{
			if(x == p[i])
			{

				count++;

				temp = count;

				for(int j = 0; j < count; j++)
				{
					temp *= -1;
				}

				x += temp;

				i = -1;

			}
		}

		System.out.println(x);
	}

} import java.util.Scanner; Scanner java.util public class Main
{

	public static void main(String args[])
	{

		int count = 0;
		int temp = 0;

		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();
		}
		sc.close();

		for(int i = 0; i < n; i++)
		{
			if(x == p[i])
			{

				count++;

				temp = count;

				for(int j = 0; j < count; j++)
				{
					temp *= -1;
				}

				x += temp;

				i = -1;

			}
		}

		System.out.println(x);
	}

} Main public static void main(String args[])
	{

		int count = 0;
		int temp = 0;

		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();
		}
		sc.close();

		for(int i = 0; i < n; i++)
		{
			if(x == p[i])
			{

				count++;

				temp = count;

				for(int j = 0; j < count; j++)
				{
					temp *= -1;
				}

				x += temp;

				i = -1;

			}
		}

		System.out.println(x);
	} main {

		int count = 0;
		int temp = 0;

		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();
		}
		sc.close();

		for(int i = 0; i < n; i++)
		{
			if(x == p[i])
			{

				count++;

				temp = count;

				for(int j = 0; j < count; j++)
				{
					temp *= -1;
				}

				x += temp;

				i = -1;

			}
		}

		System.out.println(x);
	} int count = 0; count 0 int temp = 0; temp 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 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 sc.close() sc.close sc for(int i = 0; i < n; i++)
		{
			if(x == p[i])
			{

				count++;

				temp = count;

				for(int j = 0; j < count; j++)
				{
					temp *= -1;
				}

				x += temp;

				i = -1;

			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			if(x == p[i])
			{

				count++;

				temp = count;

				for(int j = 0; j < count; j++)
				{
					temp *= -1;
				}

				x += temp;

				i = -1;

			}
		} {
			if(x == p[i])
			{

				count++;

				temp = count;

				for(int j = 0; j < count; j++)
				{
					temp *= -1;
				}

				x += temp;

				i = -1;

			}
		} if(x == p[i])
			{

				count++;

				temp = count;

				for(int j = 0; j < count; j++)
				{
					temp *= -1;
				}

				x += temp;

				i = -1;

			} x == p[i] x p[i] p i {

				count++;

				temp = count;

				for(int j = 0; j < count; j++)
				{
					temp *= -1;
				}

				x += temp;

				i = -1;

			} count++ count temp = count temp count for(int j = 0; j < count; j++)
				{
					temp *= -1;
				} int j = 0; int j = 0; j 0 j < count j count j++ j++ j {
					temp *= -1;
				} {
					temp *= -1;
				} temp *= -1 temp -1 1 x += temp x temp i = -1 i -1 1 System.out.println(x) System.out.println System.out System System.out x String args[] args public class Main
{

	public static void main(String args[])
	{

		int count = 0;
		int temp = 0;

		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();
		}
		sc.close();

		for(int i = 0; i < n; i++)
		{
			if(x == p[i])
			{

				count++;

				temp = count;

				for(int j = 0; j < count; j++)
				{
					temp *= -1;
				}

				x += temp;

				i = -1;

			}
		}

		System.out.println(x);
	}

} public class Main
{

	public static void main(String args[])
	{

		int count = 0;
		int temp = 0;

		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();
		}
		sc.close();

		for(int i = 0; i < n; i++)
		{
			if(x == p[i])
			{

				count++;

				temp = count;

				for(int j = 0; j < count; j++)
				{
					temp *= -1;
				}

				x += temp;

				i = -1;

			}
		}

		System.out.println(x);
	}

} Main
import java.util.Scanner;

public class Main
{

	public static void main(String args[])
	{

		int count = 0;
		int temp = 0;

		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();
		}
		sc.close();

		for(int i = 0; i < n; i++)
		{
			if(x == p[i])
			{

				count++;

				temp = count;

				for(int j = 0; j < count; j++)
				{
					temp *= -1;
				}

				x += temp;

				i = -1;

			}
		}

		System.out.println(x);
	}

}
