import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		int p[] = new int[n];
		for(int i=0;i<n;i++) {
			p[i] = sc.nextInt();
		}
		int idx =-1;
		int min = 1000;
		Set<Integer> s=  new HashSet<Integer>();
		for(int i=0;i<n;i++) {
			s.add(p[i]);
		}
		for(int i=-100;i<=200;i++) {
			if(!s.contains(i) && Math.abs(i-x)<min) {
				min = Math.abs(i-x);
				idx = i;
			}
		}
		System.out.println(idx);
	}
} import java.util.HashSet; HashSet java.util import java.util.Scanner; Scanner java.util import java.util.Set; Set 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 p[] = new int[n];
		for(int i=0;i<n;i++) {
			p[i] = sc.nextInt();
		}
		int idx =-1;
		int min = 1000;
		Set<Integer> s=  new HashSet<Integer>();
		for(int i=0;i<n;i++) {
			s.add(p[i]);
		}
		for(int i=-100;i<=200;i++) {
			if(!s.contains(i) && Math.abs(i-x)<min) {
				min = Math.abs(i-x);
				idx = i;
			}
		}
		System.out.println(idx);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		int p[] = new int[n];
		for(int i=0;i<n;i++) {
			p[i] = sc.nextInt();
		}
		int idx =-1;
		int min = 1000;
		Set<Integer> s=  new HashSet<Integer>();
		for(int i=0;i<n;i++) {
			s.add(p[i]);
		}
		for(int i=-100;i<=200;i++) {
			if(!s.contains(i) && Math.abs(i-x)<min) {
				min = Math.abs(i-x);
				idx = i;
			}
		}
		System.out.println(idx);
	} main {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		int p[] = new int[n];
		for(int i=0;i<n;i++) {
			p[i] = sc.nextInt();
		}
		int idx =-1;
		int min = 1000;
		Set<Integer> s=  new HashSet<Integer>();
		for(int i=0;i<n;i++) {
			s.add(p[i]);
		}
		for(int i=-100;i<=200;i++) {
			if(!s.contains(i) && Math.abs(i-x)<min) {
				min = Math.abs(i-x);
				idx = i;
			}
		}
		System.out.println(idx);
	} 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 p[] = new int[n]; p new int[n] n for(int i=0;i<n;i++) {
			p[i] = sc.nextInt();
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			p[i] = sc.nextInt();
		} {
			p[i] = sc.nextInt();
		} p[i] = sc.nextInt() p[i] p i sc.nextInt() sc.nextInt sc int idx =-1; idx -1 1 int min = 1000; min 1000 Set<Integer> s=  new HashSet<Integer>(); s new HashSet<Integer>() for(int i=0;i<n;i++) {
			s.add(p[i]);
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			s.add(p[i]);
		} {
			s.add(p[i]);
		} s.add(p[i]) s.add s p[i] p i for(int i=-100;i<=200;i++) {
			if(!s.contains(i) && Math.abs(i-x)<min) {
				min = Math.abs(i-x);
				idx = i;
			}
		} int i=-100; int i=-100; i -100 100 i<=200 i 200 i++ i++ i {
			if(!s.contains(i) && Math.abs(i-x)<min) {
				min = Math.abs(i-x);
				idx = i;
			}
		} {
			if(!s.contains(i) && Math.abs(i-x)<min) {
				min = Math.abs(i-x);
				idx = i;
			}
		} if(!s.contains(i) && Math.abs(i-x)<min) {
				min = Math.abs(i-x);
				idx = i;
			} !s.contains(i) && Math.abs(i-x)<min !s.contains(i) s.contains(i) s.contains s i Math.abs(i-x)<min Math.abs(i-x) Math.abs Math i-x i x min {
				min = Math.abs(i-x);
				idx = i;
			} min = Math.abs(i-x) min Math.abs(i-x) Math.abs Math i-x i x idx = i idx i System.out.println(idx) System.out.println System.out System System.out idx 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 p[] = new int[n];
		for(int i=0;i<n;i++) {
			p[i] = sc.nextInt();
		}
		int idx =-1;
		int min = 1000;
		Set<Integer> s=  new HashSet<Integer>();
		for(int i=0;i<n;i++) {
			s.add(p[i]);
		}
		for(int i=-100;i<=200;i++) {
			if(!s.contains(i) && Math.abs(i-x)<min) {
				min = Math.abs(i-x);
				idx = i;
			}
		}
		System.out.println(idx);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		int p[] = new int[n];
		for(int i=0;i<n;i++) {
			p[i] = sc.nextInt();
		}
		int idx =-1;
		int min = 1000;
		Set<Integer> s=  new HashSet<Integer>();
		for(int i=0;i<n;i++) {
			s.add(p[i]);
		}
		for(int i=-100;i<=200;i++) {
			if(!s.contains(i) && Math.abs(i-x)<min) {
				min = Math.abs(i-x);
				idx = i;
			}
		}
		System.out.println(idx);
	}
} Main
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		int p[] = new int[n];
		for(int i=0;i<n;i++) {
			p[i] = sc.nextInt();
		}
		int idx =-1;
		int min = 1000;
		Set<Integer> s=  new HashSet<Integer>();
		for(int i=0;i<n;i++) {
			s.add(p[i]);
		}
		for(int i=-100;i<=200;i++) {
			if(!s.contains(i) && Math.abs(i-x)<min) {
				min = Math.abs(i-x);
				idx = i;
			}
		}
		System.out.println(idx);
	}
}
