#include <iostream>
using namespace std;

bool a[101];
int main() {
  int x, n, p;
  cin >> x >> n;
  for (int i = 0; i < n; ++i) {
    cin >> p;
    a[p] = true;
  }
  int b = 111, c;
  for (int i = 0; i <= 101; ++i) {
    if (!a[i] && abs(i - x) < b) {
      b = abs(i - x);
      c = i;
    }
  }
  cout << c;
}