import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.flush();
		out.close();
	}
}

class Pair {
	int first;
	int second;

	Pair(int first, int second) {
		this.first = first;
		this.second = second;
	}
}

class TaskB {

	public void solve(int testNumber, InputReader in, PrintWriter pw) {
		int X = in.nextInt();
		int N = in.nextInt();
		boolean arr[] = new boolean[102];
		Arrays.fill(arr, true);
//		ArrayList<Integer> ans=new ArrayList<Integer>();
		int num[] = new int[N];
		for (int i = 0; i < N; i++) {
			num[i] = in.nextInt();
			arr[num[i]] = false;
		}
		int min = Integer.MAX_VALUE;
		int index = -1;
		for (int i = 0; i <= X; i++) {
			if (arr[i]) {
				int temp = Math.abs(X - i);
				if (temp < min) {
					index = i;
					min = temp;
				}

			}
		}
		for (int i = X + 1; i <= 101; i++) {
			if (arr[i]) {
				int temp = Math.abs(X - i);
				if (temp < min) {
					index = i;
					min = temp;
				}

			}
		}
		pw.println(index);

	}

	long __gcd(long a, long b) {
		if (b == 0)
			return a;
		return __gcd(b, a % b);

	}

	public int getInt(int num) {
		int ret = -1;
		switch (num) {
		case 0:
			ret = 6;
			break;
		case 1:
			ret = 2;
			break;
		case 2:
			ret = 5;
			break;
		case 3:
			ret = 5;
			break;
		case 4:
			ret = 4;
			break;
		case 5:
			ret = 5;
			break;
		case 6:
			ret = 6;
			break;
		case 7:
			ret = 3;
			break;
		case 8:
			ret = 7;
			break;
		case 9:
			ret = 6;
			break;
		}
		return ret;
	}

	public int isPow(long num) {
		int count = 0;
		while (num > 0) {
			num /= 2;
			count++;
		}
		return count;
	}
}

class InputReader {
	BufferedReader br;
	StringTokenizer st;

	public InputReader(InputStream in) {
		br = new BufferedReader(new InputStreamReader(in));
		st = null;
	}

	public String next() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.BufferedWriter; BufferedWriter java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.OutputStreamWriter; OutputStreamWriter java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Arrays; Arrays java.util import java.util.StringTokenizer; StringTokenizer java.util public class Main {
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.flush();
		out.close();
	}
} Main public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.flush();
		out.close();
	} main {
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.flush();
		out.close();
	} InputReader in = new InputReader(System.in); in new InputReader(System.in) PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true); out new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true) TaskB solver = new TaskB(); solver new TaskB() solver.solve(1, in, out) solver.solve solver 1 in out out.flush() out.flush out out.close() out.close out String[] args args class Pair {
	int first;
	int second;

	Pair(int first, int second) {
		this.first = first;
		this.second = second;
	}
} Pair int first; first int second; second Pair(int first, int second) {
		this.first = first;
		this.second = second;
	} Pair {
		this.first = first;
		this.second = second;
	} this.first = first this.first this this.first first this.second = second this.second this this.second second int first first int second second class TaskB {

	public void solve(int testNumber, InputReader in, PrintWriter pw) {
		int X = in.nextInt();
		int N = in.nextInt();
		boolean arr[] = new boolean[102];
		Arrays.fill(arr, true);
//		ArrayList<Integer> ans=new ArrayList<Integer>();
		int num[] = new int[N];
		for (int i = 0; i < N; i++) {
			num[i] = in.nextInt();
			arr[num[i]] = false;
		}
		int min = Integer.MAX_VALUE;
		int index = -1;
		for (int i = 0; i <= X; i++) {
			if (arr[i]) {
				int temp = Math.abs(X - i);
				if (temp < min) {
					index = i;
					min = temp;
				}

			}
		}
		for (int i = X + 1; i <= 101; i++) {
			if (arr[i]) {
				int temp = Math.abs(X - i);
				if (temp < min) {
					index = i;
					min = temp;
				}

			}
		}
		pw.println(index);

	}

	long __gcd(long a, long b) {
		if (b == 0)
			return a;
		return __gcd(b, a % b);

	}

	public int getInt(int num) {
		int ret = -1;
		switch (num) {
		case 0:
			ret = 6;
			break;
		case 1:
			ret = 2;
			break;
		case 2:
			ret = 5;
			break;
		case 3:
			ret = 5;
			break;
		case 4:
			ret = 4;
			break;
		case 5:
			ret = 5;
			break;
		case 6:
			ret = 6;
			break;
		case 7:
			ret = 3;
			break;
		case 8:
			ret = 7;
			break;
		case 9:
			ret = 6;
			break;
		}
		return ret;
	}

	public int isPow(long num) {
		int count = 0;
		while (num > 0) {
			num /= 2;
			count++;
		}
		return count;
	}
} TaskB public void solve(int testNumber, InputReader in, PrintWriter pw) {
		int X = in.nextInt();
		int N = in.nextInt();
		boolean arr[] = new boolean[102];
		Arrays.fill(arr, true);
//		ArrayList<Integer> ans=new ArrayList<Integer>();
		int num[] = new int[N];
		for (int i = 0; i < N; i++) {
			num[i] = in.nextInt();
			arr[num[i]] = false;
		}
		int min = Integer.MAX_VALUE;
		int index = -1;
		for (int i = 0; i <= X; i++) {
			if (arr[i]) {
				int temp = Math.abs(X - i);
				if (temp < min) {
					index = i;
					min = temp;
				}

			}
		}
		for (int i = X + 1; i <= 101; i++) {
			if (arr[i]) {
				int temp = Math.abs(X - i);
				if (temp < min) {
					index = i;
					min = temp;
				}

			}
		}
		pw.println(index);

	} solve {
		int X = in.nextInt();
		int N = in.nextInt();
		boolean arr[] = new boolean[102];
		Arrays.fill(arr, true);
//		ArrayList<Integer> ans=new ArrayList<Integer>();
		int num[] = new int[N];
		for (int i = 0; i < N; i++) {
			num[i] = in.nextInt();
			arr[num[i]] = false;
		}
		int min = Integer.MAX_VALUE;
		int index = -1;
		for (int i = 0; i <= X; i++) {
			if (arr[i]) {
				int temp = Math.abs(X - i);
				if (temp < min) {
					index = i;
					min = temp;
				}

			}
		}
		for (int i = X + 1; i <= 101; i++) {
			if (arr[i]) {
				int temp = Math.abs(X - i);
				if (temp < min) {
					index = i;
					min = temp;
				}

			}
		}
		pw.println(index);

	} int X = in.nextInt(); X in.nextInt() in.nextInt in int N = in.nextInt(); N in.nextInt() in.nextInt in boolean arr[] = new boolean[102]; arr new boolean[102] 102 Arrays.fill(arr, true) Arrays.fill Arrays arr true int num[] = new int[N]; num new int[N] N for (int i = 0; i < N; i++) {
			num[i] = in.nextInt();
			arr[num[i]] = false;
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			num[i] = in.nextInt();
			arr[num[i]] = false;
		} {
			num[i] = in.nextInt();
			arr[num[i]] = false;
		} num[i] = in.nextInt() num[i] num i in.nextInt() in.nextInt in arr[num[i]] = false arr[num[i]] arr num[i] num i false int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE int index = -1; index -1 1 for (int i = 0; i <= X; i++) {
			if (arr[i]) {
				int temp = Math.abs(X - i);
				if (temp < min) {
					index = i;
					min = temp;
				}

			}
		} int i = 0; int i = 0; i 0 i <= X i X i++ i++ i {
			if (arr[i]) {
				int temp = Math.abs(X - i);
				if (temp < min) {
					index = i;
					min = temp;
				}

			}
		} {
			if (arr[i]) {
				int temp = Math.abs(X - i);
				if (temp < min) {
					index = i;
					min = temp;
				}

			}
		} if (arr[i]) {
				int temp = Math.abs(X - i);
				if (temp < min) {
					index = i;
					min = temp;
				}

			} arr[i] arr i {
				int temp = Math.abs(X - i);
				if (temp < min) {
					index = i;
					min = temp;
				}

			} int temp = Math.abs(X - i); temp Math.abs(X - i) Math.abs Math X - i X i if (temp < min) {
					index = i;
					min = temp;
				} temp < min temp min {
					index = i;
					min = temp;
				} index = i index i min = temp min temp for (int i = X + 1; i <= 101; i++) {
			if (arr[i]) {
				int temp = Math.abs(X - i);
				if (temp < min) {
					index = i;
					min = temp;
				}

			}
		} int i = X + 1; int i = X + 1; i X + 1 X 1 i <= 101 i 101 i++ i++ i {
			if (arr[i]) {
				int temp = Math.abs(X - i);
				if (temp < min) {
					index = i;
					min = temp;
				}

			}
		} {
			if (arr[i]) {
				int temp = Math.abs(X - i);
				if (temp < min) {
					index = i;
					min = temp;
				}

			}
		} if (arr[i]) {
				int temp = Math.abs(X - i);
				if (temp < min) {
					index = i;
					min = temp;
				}

			} arr[i] arr i {
				int temp = Math.abs(X - i);
				if (temp < min) {
					index = i;
					min = temp;
				}

			} int temp = Math.abs(X - i); temp Math.abs(X - i) Math.abs Math X - i X i if (temp < min) {
					index = i;
					min = temp;
				} temp < min temp min {
					index = i;
					min = temp;
				} index = i index i min = temp min temp pw.println(index) pw.println pw index int testNumber testNumber InputReader in in PrintWriter pw pw long __gcd(long a, long b) {
		if (b == 0)
			return a;
		return __gcd(b, a % b);

	} __gcd {
		if (b == 0)
			return a;
		return __gcd(b, a % b);

	} if (b == 0)
			return a; b == 0 b 0 return a; a return __gcd(b, a % b); __gcd(b, a % b) __gcd b a % b a b long a a long b b public int getInt(int num) {
		int ret = -1;
		switch (num) {
		case 0:
			ret = 6;
			break;
		case 1:
			ret = 2;
			break;
		case 2:
			ret = 5;
			break;
		case 3:
			ret = 5;
			break;
		case 4:
			ret = 4;
			break;
		case 5:
			ret = 5;
			break;
		case 6:
			ret = 6;
			break;
		case 7:
			ret = 3;
			break;
		case 8:
			ret = 7;
			break;
		case 9:
			ret = 6;
			break;
		}
		return ret;
	} getInt {
		int ret = -1;
		switch (num) {
		case 0:
			ret = 6;
			break;
		case 1:
			ret = 2;
			break;
		case 2:
			ret = 5;
			break;
		case 3:
			ret = 5;
			break;
		case 4:
			ret = 4;
			break;
		case 5:
			ret = 5;
			break;
		case 6:
			ret = 6;
			break;
		case 7:
			ret = 3;
			break;
		case 8:
			ret = 7;
			break;
		case 9:
			ret = 6;
			break;
		}
		return ret;
	} int ret = -1; ret -1 1 switch (num) {
		case 0:
			ret = 6;
			break;
		case 1:
			ret = 2;
			break;
		case 2:
			ret = 5;
			break;
		case 3:
			ret = 5;
			break;
		case 4:
			ret = 4;
			break;
		case 5:
			ret = 5;
			break;
		case 6:
			ret = 6;
			break;
		case 7:
			ret = 3;
			break;
		case 8:
			ret = 7;
			break;
		case 9:
			ret = 6;
			break;
		} num case 0: 0 case 0: ret = 6 ret 6 break; case 1: 1 case 1: ret = 2 ret 2 break; case 2: 2 case 2: ret = 5 ret 5 break; case 3: 3 case 3: ret = 5 ret 5 break; case 4: 4 case 4: ret = 4 ret 4 break; case 5: 5 case 5: ret = 5 ret 5 break; case 6: 6 case 6: ret = 6 ret 6 break; case 7: 7 case 7: ret = 3 ret 3 break; case 8: 8 case 8: ret = 7 ret 7 break; case 9: 9 case 9: ret = 6 ret 6 break; return ret; ret int num num public int isPow(long num) {
		int count = 0;
		while (num > 0) {
			num /= 2;
			count++;
		}
		return count;
	} isPow {
		int count = 0;
		while (num > 0) {
			num /= 2;
			count++;
		}
		return count;
	} int count = 0; count 0 while (num > 0) {
			num /= 2;
			count++;
		} num > 0 num 0 {
			num /= 2;
			count++;
		} num /= 2 num 2 count++ count return count; count long num num class InputReader {
	BufferedReader br;
	StringTokenizer st;

	public InputReader(InputStream in) {
		br = new BufferedReader(new InputStreamReader(in));
		st = null;
	}

	public String next() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
} InputReader BufferedReader br; br StringTokenizer st; st public InputReader(InputStream in) {
		br = new BufferedReader(new InputStreamReader(in));
		st = null;
	} InputReader {
		br = new BufferedReader(new InputStreamReader(in));
		st = null;
	} br = new BufferedReader(new InputStreamReader(in)) br new BufferedReader(new InputStreamReader(in)) st = null st null InputStream in in public String next() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	} next {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	} while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		} st == null || !st.hasMoreTokens() st == null st null !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		} try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			} catch (IOException e) {
				throw new RuntimeException(e);
			} IOException e {
				throw new RuntimeException(e);
			} throw new RuntimeException(e); new RuntimeException(e) {
				st = new StringTokenizer(br.readLine());
			} st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st public int nextInt() {
		return Integer.parseInt(next());
	} nextInt {
		return Integer.parseInt(next());
	} return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public long nextLong() {
		return Long.parseLong(next());
	} nextLong {
		return Long.parseLong(next());
	} return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public double nextDouble() {
		return Double.parseDouble(next());
	} nextDouble {
		return Double.parseDouble(next());
	} return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next public class Main {
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.flush();
		out.close();
	}
} public class Main {
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.flush();
		out.close();
	}
} Main
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.flush();
		out.close();
	}
}

class Pair {
	int first;
	int second;

	Pair(int first, int second) {
		this.first = first;
		this.second = second;
	}
}

class TaskB {

	public void solve(int testNumber, InputReader in, PrintWriter pw) {
		int X = in.nextInt();
		int N = in.nextInt();
		boolean arr[] = new boolean[102];
		Arrays.fill(arr, true);
//		ArrayList<Integer> ans=new ArrayList<Integer>();
		int num[] = new int[N];
		for (int i = 0; i < N; i++) {
			num[i] = in.nextInt();
			arr[num[i]] = false;
		}
		int min = Integer.MAX_VALUE;
		int index = -1;
		for (int i = 0; i <= X; i++) {
			if (arr[i]) {
				int temp = Math.abs(X - i);
				if (temp < min) {
					index = i;
					min = temp;
				}

			}
		}
		for (int i = X + 1; i <= 101; i++) {
			if (arr[i]) {
				int temp = Math.abs(X - i);
				if (temp < min) {
					index = i;
					min = temp;
				}

			}
		}
		pw.println(index);

	}

	long __gcd(long a, long b) {
		if (b == 0)
			return a;
		return __gcd(b, a % b);

	}

	public int getInt(int num) {
		int ret = -1;
		switch (num) {
		case 0:
			ret = 6;
			break;
		case 1:
			ret = 2;
			break;
		case 2:
			ret = 5;
			break;
		case 3:
			ret = 5;
			break;
		case 4:
			ret = 4;
			break;
		case 5:
			ret = 5;
			break;
		case 6:
			ret = 6;
			break;
		case 7:
			ret = 3;
			break;
		case 8:
			ret = 7;
			break;
		case 9:
			ret = 6;
			break;
		}
		return ret;
	}

	public int isPow(long num) {
		int count = 0;
		while (num > 0) {
			num /= 2;
			count++;
		}
		return count;
	}
}

class InputReader {
	BufferedReader br;
	StringTokenizer st;

	public InputReader(InputStream in) {
		br = new BufferedReader(new InputStreamReader(in));
		st = null;
	}

	public String next() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}
