import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastScanner in = new FastScanner(System.in);
		int x = in.nextInt();
		int n = in.nextInt();
		int min = Integer.MAX_VALUE;
		int num = 0;
		boolean[] mark = new boolean[102];
		
		for(int i = 0; i < n; i++)
		{
			int pos = in.nextInt();
			mark[pos] = true;
		}
		
		for(int i = 0; i < mark.length; i++)
			if(!mark[i])
			{
				if(Math.abs(x - i) < min) {
					min = Math.abs(x - i);
					num = i;
				}
			}
		
		System.out.println(num);
	}

}
///////////////////////////////////TEMPLATE///////////////////////////////////
class FastScanner {
	BufferedReader br;
	StringTokenizer st;

	FastScanner(InputStream stream) {
		try {
			br = new BufferedReader(new InputStreamReader(stream));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	FastScanner(File input) {
		try {
			br = new BufferedReader(new FileReader(input));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	String nextLine() {
		String s = "";
		try {
			s = br.readLine();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return s;
	}

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

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

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

	double nextDouble() {
		return Double.parseDouble(next());
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.File; File java.io import java.io.FileReader; FileReader 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.util.StringTokenizer; StringTokenizer java.util public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastScanner in = new FastScanner(System.in);
		int x = in.nextInt();
		int n = in.nextInt();
		int min = Integer.MAX_VALUE;
		int num = 0;
		boolean[] mark = new boolean[102];
		
		for(int i = 0; i < n; i++)
		{
			int pos = in.nextInt();
			mark[pos] = true;
		}
		
		for(int i = 0; i < mark.length; i++)
			if(!mark[i])
			{
				if(Math.abs(x - i) < min) {
					min = Math.abs(x - i);
					num = i;
				}
			}
		
		System.out.println(num);
	}

} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastScanner in = new FastScanner(System.in);
		int x = in.nextInt();
		int n = in.nextInt();
		int min = Integer.MAX_VALUE;
		int num = 0;
		boolean[] mark = new boolean[102];
		
		for(int i = 0; i < n; i++)
		{
			int pos = in.nextInt();
			mark[pos] = true;
		}
		
		for(int i = 0; i < mark.length; i++)
			if(!mark[i])
			{
				if(Math.abs(x - i) < min) {
					min = Math.abs(x - i);
					num = i;
				}
			}
		
		System.out.println(num);
	} main {
		// TODO Auto-generated method stub
		FastScanner in = new FastScanner(System.in);
		int x = in.nextInt();
		int n = in.nextInt();
		int min = Integer.MAX_VALUE;
		int num = 0;
		boolean[] mark = new boolean[102];
		
		for(int i = 0; i < n; i++)
		{
			int pos = in.nextInt();
			mark[pos] = true;
		}
		
		for(int i = 0; i < mark.length; i++)
			if(!mark[i])
			{
				if(Math.abs(x - i) < min) {
					min = Math.abs(x - i);
					num = i;
				}
			}
		
		System.out.println(num);
	} FastScanner in = new FastScanner(System.in); in new FastScanner(System.in) int x = in.nextInt(); x in.nextInt() in.nextInt in int n = in.nextInt(); n in.nextInt() in.nextInt in int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE int num = 0; num 0 boolean[] mark = new boolean[102]; mark new boolean[102] 102 for(int i = 0; i < n; i++)
		{
			int pos = in.nextInt();
			mark[pos] = true;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			int pos = in.nextInt();
			mark[pos] = true;
		} {
			int pos = in.nextInt();
			mark[pos] = true;
		} int pos = in.nextInt(); pos in.nextInt() in.nextInt in mark[pos] = true mark[pos] mark pos true for(int i = 0; i < mark.length; i++)
			if(!mark[i])
			{
				if(Math.abs(x - i) < min) {
					min = Math.abs(x - i);
					num = i;
				}
			} int i = 0; int i = 0; i 0 i < mark.length i mark.length mark mark.length i++ i++ i if(!mark[i])
			{
				if(Math.abs(x - i) < min) {
					min = Math.abs(x - i);
					num = i;
				}
			} if(!mark[i])
			{
				if(Math.abs(x - i) < min) {
					min = Math.abs(x - i);
					num = i;
				}
			} !mark[i] mark[i] mark i {
				if(Math.abs(x - i) < min) {
					min = Math.abs(x - i);
					num = i;
				}
			} if(Math.abs(x - i) < min) {
					min = Math.abs(x - i);
					num = i;
				} Math.abs(x - i) < min Math.abs(x - i) Math.abs Math x - i x i min {
					min = Math.abs(x - i);
					num = i;
				} min = Math.abs(x - i) min Math.abs(x - i) Math.abs Math x - i x i num = i num i System.out.println(num) System.out.println System.out System System.out num String[] args args class FastScanner {
	BufferedReader br;
	StringTokenizer st;

	FastScanner(InputStream stream) {
		try {
			br = new BufferedReader(new InputStreamReader(stream));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	FastScanner(File input) {
		try {
			br = new BufferedReader(new FileReader(input));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	String nextLine() {
		String s = "";
		try {
			s = br.readLine();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return s;
	}

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

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

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

	double nextDouble() {
		return Double.parseDouble(next());
	}
} FastScanner BufferedReader br; br StringTokenizer st; st FastScanner(InputStream stream) {
		try {
			br = new BufferedReader(new InputStreamReader(stream));
		} catch (Exception e) {
			e.printStackTrace();
		}
	} FastScanner {
		try {
			br = new BufferedReader(new InputStreamReader(stream));
		} catch (Exception e) {
			e.printStackTrace();
		}
	} try {
			br = new BufferedReader(new InputStreamReader(stream));
		} catch (Exception e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		} Exception e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			br = new BufferedReader(new InputStreamReader(stream));
		} br = new BufferedReader(new InputStreamReader(stream)) br new BufferedReader(new InputStreamReader(stream)) InputStream stream stream FastScanner(File input) {
		try {
			br = new BufferedReader(new FileReader(input));
		} catch (Exception e) {
			e.printStackTrace();
		}
	} FastScanner {
		try {
			br = new BufferedReader(new FileReader(input));
		} catch (Exception e) {
			e.printStackTrace();
		}
	} try {
			br = new BufferedReader(new FileReader(input));
		} catch (Exception e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		} Exception e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			br = new BufferedReader(new FileReader(input));
		} br = new BufferedReader(new FileReader(input)) br new BufferedReader(new FileReader(input)) File input input String nextLine() {
		String s = "";
		try {
			s = br.readLine();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return s;
	} nextLine {
		String s = "";
		try {
			s = br.readLine();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return s;
	} String s = ""; s "" try {
			s = br.readLine();
		} catch (IOException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} IOException e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			s = br.readLine();
		} s = br.readLine() s br.readLine() br.readLine br return s; s String next() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return st.nextToken();
	} next {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return st.nextToken();
	} while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				e.printStackTrace();
			}
		} st == null || !st.hasMoreTokens() st == null st null !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				e.printStackTrace();
			}
		} try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				e.printStackTrace();
			} catch (IOException e) {
				e.printStackTrace();
			} IOException e {
				e.printStackTrace();
			} e.printStackTrace() e.printStackTrace e {
				st = new StringTokenizer(br.readLine());
			} st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st int nextInt() {
		return Integer.parseInt(next());
	} nextInt {
		return Integer.parseInt(next());
	} return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next long nextLong() {
		return Long.parseLong(next());
	} nextLong {
		return Long.parseLong(next());
	} return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next 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) {
		// TODO Auto-generated method stub
		FastScanner in = new FastScanner(System.in);
		int x = in.nextInt();
		int n = in.nextInt();
		int min = Integer.MAX_VALUE;
		int num = 0;
		boolean[] mark = new boolean[102];
		
		for(int i = 0; i < n; i++)
		{
			int pos = in.nextInt();
			mark[pos] = true;
		}
		
		for(int i = 0; i < mark.length; i++)
			if(!mark[i])
			{
				if(Math.abs(x - i) < min) {
					min = Math.abs(x - i);
					num = i;
				}
			}
		
		System.out.println(num);
	}

} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastScanner in = new FastScanner(System.in);
		int x = in.nextInt();
		int n = in.nextInt();
		int min = Integer.MAX_VALUE;
		int num = 0;
		boolean[] mark = new boolean[102];
		
		for(int i = 0; i < n; i++)
		{
			int pos = in.nextInt();
			mark[pos] = true;
		}
		
		for(int i = 0; i < mark.length; i++)
			if(!mark[i])
			{
				if(Math.abs(x - i) < min) {
					min = Math.abs(x - i);
					num = i;
				}
			}
		
		System.out.println(num);
	}

} Main
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastScanner in = new FastScanner(System.in);
		int x = in.nextInt();
		int n = in.nextInt();
		int min = Integer.MAX_VALUE;
		int num = 0;
		boolean[] mark = new boolean[102];
		
		for(int i = 0; i < n; i++)
		{
			int pos = in.nextInt();
			mark[pos] = true;
		}
		
		for(int i = 0; i < mark.length; i++)
			if(!mark[i])
			{
				if(Math.abs(x - i) < min) {
					min = Math.abs(x - i);
					num = i;
				}
			}
		
		System.out.println(num);
	}

}
///////////////////////////////////TEMPLATE///////////////////////////////////
class FastScanner {
	BufferedReader br;
	StringTokenizer st;

	FastScanner(InputStream stream) {
		try {
			br = new BufferedReader(new InputStreamReader(stream));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	FastScanner(File input) {
		try {
			br = new BufferedReader(new FileReader(input));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	String nextLine() {
		String s = "";
		try {
			s = br.readLine();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return s;
	}

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

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

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

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