import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		Main mainObj = new Main();
		mainObj.solve();
	}

	public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		
		int x = fs.nextInt();
		int n = fs.nextInt();
		
		if(n == 0) {
			System.out.println(x);
			return;
		}
		
		int[] pArr = fs.nextIntArr(n);
		Arrays.sort(pArr);
		
		int minDiff = 1_000_000;
		int candidate = -1;
		
		for(int i = 0; i < 1000; i++) {
			if(exist(pArr, i)) {
				continue;
			}
			if(Math.abs(i-x) < minDiff) {
				minDiff = Math.abs(i-x);
				candidate = i;
			}
		}
		
		System.out.println(candidate);
	}
	
	boolean exist(int[] intArr, int value) {
		for(int arrContent : intArr) {
			if(arrContent == value) {
				return true;
			}
		}
		
		return false;
	}

	

	public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

		public void close() throws IOException {
			reader.close();
		}
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader 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) throws IOException {
		Main mainObj = new Main();
		mainObj.solve();
	}

	public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		
		int x = fs.nextInt();
		int n = fs.nextInt();
		
		if(n == 0) {
			System.out.println(x);
			return;
		}
		
		int[] pArr = fs.nextIntArr(n);
		Arrays.sort(pArr);
		
		int minDiff = 1_000_000;
		int candidate = -1;
		
		for(int i = 0; i < 1000; i++) {
			if(exist(pArr, i)) {
				continue;
			}
			if(Math.abs(i-x) < minDiff) {
				minDiff = Math.abs(i-x);
				candidate = i;
			}
		}
		
		System.out.println(candidate);
	}
	
	boolean exist(int[] intArr, int value) {
		for(int arrContent : intArr) {
			if(arrContent == value) {
				return true;
			}
		}
		
		return false;
	}

	

	public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

		public void close() throws IOException {
			reader.close();
		}
	}

} Main public static void main(String[] args) throws IOException {
		Main mainObj = new Main();
		mainObj.solve();
	} main {
		Main mainObj = new Main();
		mainObj.solve();
	} Main mainObj = new Main(); mainObj new Main() mainObj.solve() mainObj.solve mainObj String[] args args public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		
		int x = fs.nextInt();
		int n = fs.nextInt();
		
		if(n == 0) {
			System.out.println(x);
			return;
		}
		
		int[] pArr = fs.nextIntArr(n);
		Arrays.sort(pArr);
		
		int minDiff = 1_000_000;
		int candidate = -1;
		
		for(int i = 0; i < 1000; i++) {
			if(exist(pArr, i)) {
				continue;
			}
			if(Math.abs(i-x) < minDiff) {
				minDiff = Math.abs(i-x);
				candidate = i;
			}
		}
		
		System.out.println(candidate);
	} solve {
		FastScanner fs = new FastScanner();
		
		int x = fs.nextInt();
		int n = fs.nextInt();
		
		if(n == 0) {
			System.out.println(x);
			return;
		}
		
		int[] pArr = fs.nextIntArr(n);
		Arrays.sort(pArr);
		
		int minDiff = 1_000_000;
		int candidate = -1;
		
		for(int i = 0; i < 1000; i++) {
			if(exist(pArr, i)) {
				continue;
			}
			if(Math.abs(i-x) < minDiff) {
				minDiff = Math.abs(i-x);
				candidate = i;
			}
		}
		
		System.out.println(candidate);
	} FastScanner fs = new FastScanner(); fs new FastScanner() int x = fs.nextInt(); x fs.nextInt() fs.nextInt fs int n = fs.nextInt(); n fs.nextInt() fs.nextInt fs if(n == 0) {
			System.out.println(x);
			return;
		} n == 0 n 0 {
			System.out.println(x);
			return;
		} System.out.println(x) System.out.println System.out System System.out x return; int[] pArr = fs.nextIntArr(n); pArr fs.nextIntArr(n) fs.nextIntArr fs n Arrays.sort(pArr) Arrays.sort Arrays pArr int minDiff = 1_000_000; minDiff 1_000_000 int candidate = -1; candidate -1 1 for(int i = 0; i < 1000; i++) {
			if(exist(pArr, i)) {
				continue;
			}
			if(Math.abs(i-x) < minDiff) {
				minDiff = Math.abs(i-x);
				candidate = i;
			}
		} int i = 0; int i = 0; i 0 i < 1000 i 1000 i++ i++ i {
			if(exist(pArr, i)) {
				continue;
			}
			if(Math.abs(i-x) < minDiff) {
				minDiff = Math.abs(i-x);
				candidate = i;
			}
		} {
			if(exist(pArr, i)) {
				continue;
			}
			if(Math.abs(i-x) < minDiff) {
				minDiff = Math.abs(i-x);
				candidate = i;
			}
		} if(exist(pArr, i)) {
				continue;
			} exist(pArr, i) exist pArr i {
				continue;
			} continue; if(Math.abs(i-x) < minDiff) {
				minDiff = Math.abs(i-x);
				candidate = i;
			} Math.abs(i-x) < minDiff Math.abs(i-x) Math.abs Math i-x i x minDiff {
				minDiff = Math.abs(i-x);
				candidate = i;
			} minDiff = Math.abs(i-x) minDiff Math.abs(i-x) Math.abs Math i-x i x candidate = i candidate i System.out.println(candidate) System.out.println System.out System System.out candidate boolean exist(int[] intArr, int value) {
		for(int arrContent : intArr) {
			if(arrContent == value) {
				return true;
			}
		}
		
		return false;
	} exist {
		for(int arrContent : intArr) {
			if(arrContent == value) {
				return true;
			}
		}
		
		return false;
	} for(int arrContent : intArr) {
			if(arrContent == value) {
				return true;
			}
		} int arrContent intArr {
			if(arrContent == value) {
				return true;
			}
		} {
			if(arrContent == value) {
				return true;
			}
		} if(arrContent == value) {
				return true;
			} arrContent == value arrContent value {
				return true;
			} return true; true return false; false int[] intArr intArr int value value public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

		public void close() throws IOException {
			reader.close();
		}
	} FastScanner BufferedReader reader; reader private StringTokenizer st; st public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		} FastScanner {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		} st = null st null reader = new BufferedReader(new InputStreamReader(System.in)) reader new BufferedReader(new InputStreamReader(System.in)) public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		} next {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		} if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			} st == null || !st.hasMoreElements() st == null st null !st.hasMoreElements() st.hasMoreElements() st.hasMoreElements st {
				st = new StringTokenizer(reader.readLine());
			} st = new StringTokenizer(reader.readLine()) st new StringTokenizer(reader.readLine()) return st.nextToken(); st.nextToken() st.nextToken st public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		} nextLine {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		} st = null st null String readLine = null; readLine null readLine = reader.readLine() readLine reader.readLine() reader.readLine reader return readLine; readLine public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		} nextInt {
			return Integer.parseInt(next());
		} return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		} nextLong {
			return Long.parseLong(next());
		} return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		} nextIntArr {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		} int[] retArr = new int[n]; retArr new int[n] n for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				retArr[i] = nextInt();
			} {
				retArr[i] = nextInt();
			} retArr[i] = nextInt() retArr[i] retArr i nextInt() nextInt return retArr; retArr int n n public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		} nextLongArr {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		} long[] retArr = new long[n]; retArr new long[n] n for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				retArr[i] = nextLong();
			} {
				retArr[i] = nextLong();
			} retArr[i] = nextLong() retArr[i] retArr i nextLong() nextLong return retArr; retArr int n n public void close() throws IOException {
			reader.close();
		} close {
			reader.close();
		} reader.close() reader.close reader public class Main {

	public static void main(String[] args) throws IOException {
		Main mainObj = new Main();
		mainObj.solve();
	}

	public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		
		int x = fs.nextInt();
		int n = fs.nextInt();
		
		if(n == 0) {
			System.out.println(x);
			return;
		}
		
		int[] pArr = fs.nextIntArr(n);
		Arrays.sort(pArr);
		
		int minDiff = 1_000_000;
		int candidate = -1;
		
		for(int i = 0; i < 1000; i++) {
			if(exist(pArr, i)) {
				continue;
			}
			if(Math.abs(i-x) < minDiff) {
				minDiff = Math.abs(i-x);
				candidate = i;
			}
		}
		
		System.out.println(candidate);
	}
	
	boolean exist(int[] intArr, int value) {
		for(int arrContent : intArr) {
			if(arrContent == value) {
				return true;
			}
		}
		
		return false;
	}

	

	public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

		public void close() throws IOException {
			reader.close();
		}
	}

} public class Main {

	public static void main(String[] args) throws IOException {
		Main mainObj = new Main();
		mainObj.solve();
	}

	public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		
		int x = fs.nextInt();
		int n = fs.nextInt();
		
		if(n == 0) {
			System.out.println(x);
			return;
		}
		
		int[] pArr = fs.nextIntArr(n);
		Arrays.sort(pArr);
		
		int minDiff = 1_000_000;
		int candidate = -1;
		
		for(int i = 0; i < 1000; i++) {
			if(exist(pArr, i)) {
				continue;
			}
			if(Math.abs(i-x) < minDiff) {
				minDiff = Math.abs(i-x);
				candidate = i;
			}
		}
		
		System.out.println(candidate);
	}
	
	boolean exist(int[] intArr, int value) {
		for(int arrContent : intArr) {
			if(arrContent == value) {
				return true;
			}
		}
		
		return false;
	}

	

	public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

		public void close() throws IOException {
			reader.close();
		}
	}

} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		Main mainObj = new Main();
		mainObj.solve();
	}

	public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		
		int x = fs.nextInt();
		int n = fs.nextInt();
		
		if(n == 0) {
			System.out.println(x);
			return;
		}
		
		int[] pArr = fs.nextIntArr(n);
		Arrays.sort(pArr);
		
		int minDiff = 1_000_000;
		int candidate = -1;
		
		for(int i = 0; i < 1000; i++) {
			if(exist(pArr, i)) {
				continue;
			}
			if(Math.abs(i-x) < minDiff) {
				minDiff = Math.abs(i-x);
				candidate = i;
			}
		}
		
		System.out.println(candidate);
	}
	
	boolean exist(int[] intArr, int value) {
		for(int arrContent : intArr) {
			if(arrContent == value) {
				return true;
			}
		}
		
		return false;
	}

	

	public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

		public void close() throws IOException {
			reader.close();
		}
	}

}
