

import java.util.ArrayList;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {

		Scanner scanner=new Scanner(System.in);


		int x =scanner.nextInt();
		int n =scanner.nextInt();
		ArrayList<Integer> list = new ArrayList<Integer>();
		for(int i=0 ; i<n ; i++) {
			list.add(scanner.nextInt());
		}
		scanner.close();

		int d = 0;
		while(true) {
			if(!list.contains(x-d)) {
				System.out.println(x-d);;
				break;
			}
			if(!list.contains(x+d)) {
				System.out.println(x+d);
				break;
			}
			d++;
		}

	}

} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		Scanner scanner=new Scanner(System.in);


		int x =scanner.nextInt();
		int n =scanner.nextInt();
		ArrayList<Integer> list = new ArrayList<Integer>();
		for(int i=0 ; i<n ; i++) {
			list.add(scanner.nextInt());
		}
		scanner.close();

		int d = 0;
		while(true) {
			if(!list.contains(x-d)) {
				System.out.println(x-d);;
				break;
			}
			if(!list.contains(x+d)) {
				System.out.println(x+d);
				break;
			}
			d++;
		}

	}

} Main public static void main(String[] args) {

		Scanner scanner=new Scanner(System.in);


		int x =scanner.nextInt();
		int n =scanner.nextInt();
		ArrayList<Integer> list = new ArrayList<Integer>();
		for(int i=0 ; i<n ; i++) {
			list.add(scanner.nextInt());
		}
		scanner.close();

		int d = 0;
		while(true) {
			if(!list.contains(x-d)) {
				System.out.println(x-d);;
				break;
			}
			if(!list.contains(x+d)) {
				System.out.println(x+d);
				break;
			}
			d++;
		}

	} main {

		Scanner scanner=new Scanner(System.in);


		int x =scanner.nextInt();
		int n =scanner.nextInt();
		ArrayList<Integer> list = new ArrayList<Integer>();
		for(int i=0 ; i<n ; i++) {
			list.add(scanner.nextInt());
		}
		scanner.close();

		int d = 0;
		while(true) {
			if(!list.contains(x-d)) {
				System.out.println(x-d);;
				break;
			}
			if(!list.contains(x+d)) {
				System.out.println(x+d);
				break;
			}
			d++;
		}

	} Scanner scanner=new Scanner(System.in); scanner new Scanner(System.in) int x =scanner.nextInt(); x scanner.nextInt() scanner.nextInt scanner int n =scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner ArrayList<Integer> list = new ArrayList<Integer>(); list new ArrayList<Integer>() for(int i=0 ; i<n ; i++) {
			list.add(scanner.nextInt());
		} int i=0 ; int i=0 ; i 0 i<n i n i++ i++ i {
			list.add(scanner.nextInt());
		} {
			list.add(scanner.nextInt());
		} list.add(scanner.nextInt()) list.add list scanner.nextInt() scanner.nextInt scanner scanner.close() scanner.close scanner int d = 0; d 0 while(true) {
			if(!list.contains(x-d)) {
				System.out.println(x-d);;
				break;
			}
			if(!list.contains(x+d)) {
				System.out.println(x+d);
				break;
			}
			d++;
		} true {
			if(!list.contains(x-d)) {
				System.out.println(x-d);;
				break;
			}
			if(!list.contains(x+d)) {
				System.out.println(x+d);
				break;
			}
			d++;
		} if(!list.contains(x-d)) {
				System.out.println(x-d);;
				break;
			} !list.contains(x-d) list.contains(x-d) list.contains list x-d x d {
				System.out.println(x-d);;
				break;
			} System.out.println(x-d) System.out.println System.out System System.out x-d x d break; if(!list.contains(x+d)) {
				System.out.println(x+d);
				break;
			} !list.contains(x+d) list.contains(x+d) list.contains list x+d x d {
				System.out.println(x+d);
				break;
			} System.out.println(x+d) System.out.println System.out System System.out x+d x d break; d++ d String[] args args public class Main {

	public static void main(String[] args) {

		Scanner scanner=new Scanner(System.in);


		int x =scanner.nextInt();
		int n =scanner.nextInt();
		ArrayList<Integer> list = new ArrayList<Integer>();
		for(int i=0 ; i<n ; i++) {
			list.add(scanner.nextInt());
		}
		scanner.close();

		int d = 0;
		while(true) {
			if(!list.contains(x-d)) {
				System.out.println(x-d);;
				break;
			}
			if(!list.contains(x+d)) {
				System.out.println(x+d);
				break;
			}
			d++;
		}

	}

} public class Main {

	public static void main(String[] args) {

		Scanner scanner=new Scanner(System.in);


		int x =scanner.nextInt();
		int n =scanner.nextInt();
		ArrayList<Integer> list = new ArrayList<Integer>();
		for(int i=0 ; i<n ; i++) {
			list.add(scanner.nextInt());
		}
		scanner.close();

		int d = 0;
		while(true) {
			if(!list.contains(x-d)) {
				System.out.println(x-d);;
				break;
			}
			if(!list.contains(x+d)) {
				System.out.println(x+d);
				break;
			}
			d++;
		}

	}

} Main


import java.util.ArrayList;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {

		Scanner scanner=new Scanner(System.in);


		int x =scanner.nextInt();
		int n =scanner.nextInt();
		ArrayList<Integer> list = new ArrayList<Integer>();
		for(int i=0 ; i<n ; i++) {
			list.add(scanner.nextInt());
		}
		scanner.close();

		int d = 0;
		while(true) {
			if(!list.contains(x-d)) {
				System.out.println(x-d);;
				break;
			}
			if(!list.contains(x+d)) {
				System.out.println(x+d);
				break;
			}
			d++;
		}

	}

}
