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


public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		int ans = 0;
		int minAbs = 100;
		ArrayList<String> numList = new ArrayList<>();

		for (int i=-100; i<=101; i++) {
			numList.add(String.valueOf(i));
		}
		
		for (int i=1; i<=n; i++) {
			String p = sc.next();
			if(numList.contains(p)) {
				numList.remove(p);
			}
		}

		for (int i=0; i<numList.size(); i++) {
			int abs = Math.abs(x - Integer.parseInt(numList.get(i)));
			if(abs < minAbs) {
				minAbs = abs;
				ans = Integer.parseInt(numList.get(i));
			}
		}

		System.out.println(ans);
		sc.close();
	}

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

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		int ans = 0;
		int minAbs = 100;
		ArrayList<String> numList = new ArrayList<>();

		for (int i=-100; i<=101; i++) {
			numList.add(String.valueOf(i));
		}
		
		for (int i=1; i<=n; i++) {
			String p = sc.next();
			if(numList.contains(p)) {
				numList.remove(p);
			}
		}

		for (int i=0; i<numList.size(); i++) {
			int abs = Math.abs(x - Integer.parseInt(numList.get(i)));
			if(abs < minAbs) {
				minAbs = abs;
				ans = Integer.parseInt(numList.get(i));
			}
		}

		System.out.println(ans);
		sc.close();
	}

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

		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		int ans = 0;
		int minAbs = 100;
		ArrayList<String> numList = new ArrayList<>();

		for (int i=-100; i<=101; i++) {
			numList.add(String.valueOf(i));
		}
		
		for (int i=1; i<=n; i++) {
			String p = sc.next();
			if(numList.contains(p)) {
				numList.remove(p);
			}
		}

		for (int i=0; i<numList.size(); i++) {
			int abs = Math.abs(x - Integer.parseInt(numList.get(i)));
			if(abs < minAbs) {
				minAbs = abs;
				ans = Integer.parseInt(numList.get(i));
			}
		}

		System.out.println(ans);
		sc.close();
	} main {

		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		int ans = 0;
		int minAbs = 100;
		ArrayList<String> numList = new ArrayList<>();

		for (int i=-100; i<=101; i++) {
			numList.add(String.valueOf(i));
		}
		
		for (int i=1; i<=n; i++) {
			String p = sc.next();
			if(numList.contains(p)) {
				numList.remove(p);
			}
		}

		for (int i=0; i<numList.size(); i++) {
			int abs = Math.abs(x - Integer.parseInt(numList.get(i)));
			if(abs < minAbs) {
				minAbs = abs;
				ans = Integer.parseInt(numList.get(i));
			}
		}

		System.out.println(ans);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int ans = 0; ans 0 int minAbs = 100; minAbs 100 ArrayList<String> numList = new ArrayList<>(); numList new ArrayList<>() for (int i=-100; i<=101; i++) {
			numList.add(String.valueOf(i));
		} int i=-100; int i=-100; i -100 100 i<=101 i 101 i++ i++ i {
			numList.add(String.valueOf(i));
		} {
			numList.add(String.valueOf(i));
		} numList.add(String.valueOf(i)) numList.add numList String.valueOf(i) String.valueOf String i for (int i=1; i<=n; i++) {
			String p = sc.next();
			if(numList.contains(p)) {
				numList.remove(p);
			}
		} int i=1; int i=1; i 1 i<=n i n i++ i++ i {
			String p = sc.next();
			if(numList.contains(p)) {
				numList.remove(p);
			}
		} {
			String p = sc.next();
			if(numList.contains(p)) {
				numList.remove(p);
			}
		} String p = sc.next(); p sc.next() sc.next sc if(numList.contains(p)) {
				numList.remove(p);
			} numList.contains(p) numList.contains numList p {
				numList.remove(p);
			} numList.remove(p) numList.remove numList p for (int i=0; i<numList.size(); i++) {
			int abs = Math.abs(x - Integer.parseInt(numList.get(i)));
			if(abs < minAbs) {
				minAbs = abs;
				ans = Integer.parseInt(numList.get(i));
			}
		} int i=0; int i=0; i 0 i<numList.size() i numList.size() numList.size numList i++ i++ i {
			int abs = Math.abs(x - Integer.parseInt(numList.get(i)));
			if(abs < minAbs) {
				minAbs = abs;
				ans = Integer.parseInt(numList.get(i));
			}
		} {
			int abs = Math.abs(x - Integer.parseInt(numList.get(i)));
			if(abs < minAbs) {
				minAbs = abs;
				ans = Integer.parseInt(numList.get(i));
			}
		} int abs = Math.abs(x - Integer.parseInt(numList.get(i))); abs Math.abs(x - Integer.parseInt(numList.get(i))) Math.abs Math x - Integer.parseInt(numList.get(i)) x Integer.parseInt(numList.get(i)) Integer.parseInt Integer numList.get(i) numList.get numList i if(abs < minAbs) {
				minAbs = abs;
				ans = Integer.parseInt(numList.get(i));
			} abs < minAbs abs minAbs {
				minAbs = abs;
				ans = Integer.parseInt(numList.get(i));
			} minAbs = abs minAbs abs ans = Integer.parseInt(numList.get(i)) ans Integer.parseInt(numList.get(i)) Integer.parseInt Integer numList.get(i) numList.get numList i System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		int ans = 0;
		int minAbs = 100;
		ArrayList<String> numList = new ArrayList<>();

		for (int i=-100; i<=101; i++) {
			numList.add(String.valueOf(i));
		}
		
		for (int i=1; i<=n; i++) {
			String p = sc.next();
			if(numList.contains(p)) {
				numList.remove(p);
			}
		}

		for (int i=0; i<numList.size(); i++) {
			int abs = Math.abs(x - Integer.parseInt(numList.get(i)));
			if(abs < minAbs) {
				minAbs = abs;
				ans = Integer.parseInt(numList.get(i));
			}
		}

		System.out.println(ans);
		sc.close();
	}

} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		int ans = 0;
		int minAbs = 100;
		ArrayList<String> numList = new ArrayList<>();

		for (int i=-100; i<=101; i++) {
			numList.add(String.valueOf(i));
		}
		
		for (int i=1; i<=n; i++) {
			String p = sc.next();
			if(numList.contains(p)) {
				numList.remove(p);
			}
		}

		for (int i=0; i<numList.size(); i++) {
			int abs = Math.abs(x - Integer.parseInt(numList.get(i)));
			if(abs < minAbs) {
				minAbs = abs;
				ans = Integer.parseInt(numList.get(i));
			}
		}

		System.out.println(ans);
		sc.close();
	}

} Main
import java.util.ArrayList;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		int ans = 0;
		int minAbs = 100;
		ArrayList<String> numList = new ArrayList<>();

		for (int i=-100; i<=101; i++) {
			numList.add(String.valueOf(i));
		}
		
		for (int i=1; i<=n; i++) {
			String p = sc.next();
			if(numList.contains(p)) {
				numList.remove(p);
			}
		}

		for (int i=0; i<numList.size(); i++) {
			int abs = Math.abs(x - Integer.parseInt(numList.get(i)));
			if(abs < minAbs) {
				minAbs = abs;
				ans = Integer.parseInt(numList.get(i));
			}
		}

		System.out.println(ans);
		sc.close();
	}

}