import java.io.*;
import java.util.StringTokenizer;

public class Main{
	public static void main(String [] args) throws IOException{
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		StringTokenizer st = new StringTokenizer(br.readLine());
		int x = Integer.parseInt(st.nextToken());
		int n = Integer.parseInt(st.nextToken());

		boolean [] isVisit = new boolean[101];

		if(n > 0){
			st = new StringTokenizer(br.readLine());
			while(st.hasMoreTokens()){
				int cur = Integer.parseInt(st.nextToken());
				isVisit[cur] = true;
			}
		}

		int l = x, r = x;
		while(l > 0 && isVisit[l]) l--;
		while(r < 101 && isVisit[r]) r++;

		bw.write((x - l <= r - x ? l : r )+"" );
		bw.flush();
		bw.close();
		br.close();
	}
} import java.io.*; io.* java import java.util.StringTokenizer; StringTokenizer java.util public class Main{
	public static void main(String [] args) throws IOException{
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		StringTokenizer st = new StringTokenizer(br.readLine());
		int x = Integer.parseInt(st.nextToken());
		int n = Integer.parseInt(st.nextToken());

		boolean [] isVisit = new boolean[101];

		if(n > 0){
			st = new StringTokenizer(br.readLine());
			while(st.hasMoreTokens()){
				int cur = Integer.parseInt(st.nextToken());
				isVisit[cur] = true;
			}
		}

		int l = x, r = x;
		while(l > 0 && isVisit[l]) l--;
		while(r < 101 && isVisit[r]) r++;

		bw.write((x - l <= r - x ? l : r )+"" );
		bw.flush();
		bw.close();
		br.close();
	}
} Main public static void main(String [] args) throws IOException{
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		StringTokenizer st = new StringTokenizer(br.readLine());
		int x = Integer.parseInt(st.nextToken());
		int n = Integer.parseInt(st.nextToken());

		boolean [] isVisit = new boolean[101];

		if(n > 0){
			st = new StringTokenizer(br.readLine());
			while(st.hasMoreTokens()){
				int cur = Integer.parseInt(st.nextToken());
				isVisit[cur] = true;
			}
		}

		int l = x, r = x;
		while(l > 0 && isVisit[l]) l--;
		while(r < 101 && isVisit[r]) r++;

		bw.write((x - l <= r - x ? l : r )+"" );
		bw.flush();
		bw.close();
		br.close();
	} main {
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		StringTokenizer st = new StringTokenizer(br.readLine());
		int x = Integer.parseInt(st.nextToken());
		int n = Integer.parseInt(st.nextToken());

		boolean [] isVisit = new boolean[101];

		if(n > 0){
			st = new StringTokenizer(br.readLine());
			while(st.hasMoreTokens()){
				int cur = Integer.parseInt(st.nextToken());
				isVisit[cur] = true;
			}
		}

		int l = x, r = x;
		while(l > 0 && isVisit[l]) l--;
		while(r < 101 && isVisit[r]) r++;

		bw.write((x - l <= r - x ? l : r )+"" );
		bw.flush();
		bw.close();
		br.close();
	} BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); bw new BufferedWriter(new OutputStreamWriter(System.out)) BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) StringTokenizer st = new StringTokenizer(br.readLine()); st new StringTokenizer(br.readLine()) int x = Integer.parseInt(st.nextToken()); x Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st int n = Integer.parseInt(st.nextToken()); n Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st boolean [] isVisit = new boolean[101]; isVisit new boolean[101] 101 if(n > 0){
			st = new StringTokenizer(br.readLine());
			while(st.hasMoreTokens()){
				int cur = Integer.parseInt(st.nextToken());
				isVisit[cur] = true;
			}
		} n > 0 n 0 {
			st = new StringTokenizer(br.readLine());
			while(st.hasMoreTokens()){
				int cur = Integer.parseInt(st.nextToken());
				isVisit[cur] = true;
			}
		} st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) while(st.hasMoreTokens()){
				int cur = Integer.parseInt(st.nextToken());
				isVisit[cur] = true;
			} st.hasMoreTokens() st.hasMoreTokens st {
				int cur = Integer.parseInt(st.nextToken());
				isVisit[cur] = true;
			} int cur = Integer.parseInt(st.nextToken()); cur Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st isVisit[cur] = true isVisit[cur] isVisit cur true int l = x l x r = x; r x while(l > 0 && isVisit[l]) l--; l > 0 && isVisit[l] l > 0 l 0 isVisit[l] isVisit l l-- l while(r < 101 && isVisit[r]) r++; r < 101 && isVisit[r] r < 101 r 101 isVisit[r] isVisit r r++ r bw.write((x - l <= r - x ? l : r )+"" ) bw.write bw (x - l <= r - x ? l : r )+"" (x - l <= r - x ? l : r ) x - l <= r - x x - l x l r - x r x l r "" bw.flush() bw.flush bw bw.close() bw.close bw br.close() br.close br String [] args args public class Main{
	public static void main(String [] args) throws IOException{
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		StringTokenizer st = new StringTokenizer(br.readLine());
		int x = Integer.parseInt(st.nextToken());
		int n = Integer.parseInt(st.nextToken());

		boolean [] isVisit = new boolean[101];

		if(n > 0){
			st = new StringTokenizer(br.readLine());
			while(st.hasMoreTokens()){
				int cur = Integer.parseInt(st.nextToken());
				isVisit[cur] = true;
			}
		}

		int l = x, r = x;
		while(l > 0 && isVisit[l]) l--;
		while(r < 101 && isVisit[r]) r++;

		bw.write((x - l <= r - x ? l : r )+"" );
		bw.flush();
		bw.close();
		br.close();
	}
} public class Main{
	public static void main(String [] args) throws IOException{
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		StringTokenizer st = new StringTokenizer(br.readLine());
		int x = Integer.parseInt(st.nextToken());
		int n = Integer.parseInt(st.nextToken());

		boolean [] isVisit = new boolean[101];

		if(n > 0){
			st = new StringTokenizer(br.readLine());
			while(st.hasMoreTokens()){
				int cur = Integer.parseInt(st.nextToken());
				isVisit[cur] = true;
			}
		}

		int l = x, r = x;
		while(l > 0 && isVisit[l]) l--;
		while(r < 101 && isVisit[r]) r++;

		bw.write((x - l <= r - x ? l : r )+"" );
		bw.flush();
		bw.close();
		br.close();
	}
} Main
import java.io.*;
import java.util.StringTokenizer;

public class Main{
	public static void main(String [] args) throws IOException{
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		StringTokenizer st = new StringTokenizer(br.readLine());
		int x = Integer.parseInt(st.nextToken());
		int n = Integer.parseInt(st.nextToken());

		boolean [] isVisit = new boolean[101];

		if(n > 0){
			st = new StringTokenizer(br.readLine());
			while(st.hasMoreTokens()){
				int cur = Integer.parseInt(st.nextToken());
				isVisit[cur] = true;
			}
		}

		int l = x, r = x;
		while(l > 0 && isVisit[l]) l--;
		while(r < 101 && isVisit[r]) r++;

		bw.write((x - l <= r - x ? l : r )+"" );
		bw.flush();
		bw.close();
		br.close();
	}
}