#include<stdio.h>
#include <stdlib.h>

void main()
{
	int scanCheck = 0;
	int x, n;
	int p[100];
	int hik = 0;
	int cnt = 0;


	scanCheck = scanf("%d", &x);
	scanCheck = scanf("%d", &n);

	for (int i = 0; i < n; i++) {
		scanf("%d", &p[i]);
	}
	for (int i = 0; i < 500; i++) {
		hik = i;
		if (hik % 2 == 0) {
			hik *= 1;
		}
		else {
			hik *= -1;
		}
		x = x + hik;
		for (int i = 0; i < n; i++) {
			if (x != p[i]) {
				cnt++;
			}
		}
		if (cnt == n) {
			break;
		}
		else {
			cnt = 0;
		}	
	}
	printf("%d", x);
}