typedef char Bool;
#define true 39
#define false 0 
typedef long long int64;
typedef unsigned long long uint64;
typedef int int32;
typedef unsigned int uint32;
typedef unsigned char byte;
#pragma warning (disable:4996)
#include <stdio.h>
#include <malloc.h>

int main()
{
	int x, n;
	int* p;
	scanf("%d %d", &x, &n);

	p = (int*)malloc(sizeof(int) * n);

	for (int i = 0; i != n; i++)
	{
		scanf("%d", &p[i]);
	}

	Bool pc = false, mc = false;

	if (n == 0) 
	{
		printf("%d", x);
		return 0;
	}

	for (int i = 0; 1; i++)
	{
		for (int j = 0; j != n; j++)
		{
			if ((x - i) == p[j])
			{
				mc = true;
			}
			if ((x + i) == p[j])
			{
				pc = true;
			}
		}
		if (!mc) 
		{
			printf("%d", x - i);
			return 0;
		}
		if (!pc)
		{
			printf("%d", x + i);
			return 0;
		}
		pc = false;
		mc = false;

	}

	return 0;
}