import 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 min=0;
		int max=0;
		ArrayList p = new ArrayList<>();
		
	
		for(int i=0;i<n;i++) {
			p.add(sc.nextInt());
		}

		if(!(p.contains(x))) {
			System.out.println(x);
			System.exit(0);
		}
		
		
		for(int i=1;i<p.size();i++) {
			if(!(p.contains(x-i))) {
				System.out.println(x-i);
				System.exit(0);
			}
			else if(!(p.contains(x+i))) {
				System.out.println(x+i);
				System.exit(0);
				
			}
		}
		System.out.println(0);
		sc.close();
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x =sc.nextInt();
		int n =sc.nextInt();
		int min=0;
		int max=0;
		ArrayList p = new ArrayList<>();
		
	
		for(int i=0;i<n;i++) {
			p.add(sc.nextInt());
		}

		if(!(p.contains(x))) {
			System.out.println(x);
			System.exit(0);
		}
		
		
		for(int i=1;i<p.size();i++) {
			if(!(p.contains(x-i))) {
				System.out.println(x-i);
				System.exit(0);
			}
			else if(!(p.contains(x+i))) {
				System.out.println(x+i);
				System.exit(0);
				
			}
		}
		System.out.println(0);
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x =sc.nextInt();
		int n =sc.nextInt();
		int min=0;
		int max=0;
		ArrayList p = new ArrayList<>();
		
	
		for(int i=0;i<n;i++) {
			p.add(sc.nextInt());
		}

		if(!(p.contains(x))) {
			System.out.println(x);
			System.exit(0);
		}
		
		
		for(int i=1;i<p.size();i++) {
			if(!(p.contains(x-i))) {
				System.out.println(x-i);
				System.exit(0);
			}
			else if(!(p.contains(x+i))) {
				System.out.println(x+i);
				System.exit(0);
				
			}
		}
		System.out.println(0);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int x =sc.nextInt();
		int n =sc.nextInt();
		int min=0;
		int max=0;
		ArrayList p = new ArrayList<>();
		
	
		for(int i=0;i<n;i++) {
			p.add(sc.nextInt());
		}

		if(!(p.contains(x))) {
			System.out.println(x);
			System.exit(0);
		}
		
		
		for(int i=1;i<p.size();i++) {
			if(!(p.contains(x-i))) {
				System.out.println(x-i);
				System.exit(0);
			}
			else if(!(p.contains(x+i))) {
				System.out.println(x+i);
				System.exit(0);
				
			}
		}
		System.out.println(0);
		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 min=0; min 0 int max=0; max 0 ArrayList p = new ArrayList<>(); p new ArrayList<>() for(int i=0;i<n;i++) {
			p.add(sc.nextInt());
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			p.add(sc.nextInt());
		} {
			p.add(sc.nextInt());
		} p.add(sc.nextInt()) p.add p sc.nextInt() sc.nextInt sc if(!(p.contains(x))) {
			System.out.println(x);
			System.exit(0);
		} !(p.contains(x)) (p.contains(x)) p.contains p x {
			System.out.println(x);
			System.exit(0);
		} System.out.println(x) System.out.println System.out System System.out x System.exit(0) System.exit System 0 for(int i=1;i<p.size();i++) {
			if(!(p.contains(x-i))) {
				System.out.println(x-i);
				System.exit(0);
			}
			else if(!(p.contains(x+i))) {
				System.out.println(x+i);
				System.exit(0);
				
			}
		} int i=1; int i=1; i 1 i<p.size() i p.size() p.size p i++ i++ i {
			if(!(p.contains(x-i))) {
				System.out.println(x-i);
				System.exit(0);
			}
			else if(!(p.contains(x+i))) {
				System.out.println(x+i);
				System.exit(0);
				
			}
		} {
			if(!(p.contains(x-i))) {
				System.out.println(x-i);
				System.exit(0);
			}
			else if(!(p.contains(x+i))) {
				System.out.println(x+i);
				System.exit(0);
				
			}
		} if(!(p.contains(x-i))) {
				System.out.println(x-i);
				System.exit(0);
			}
			else if(!(p.contains(x+i))) {
				System.out.println(x+i);
				System.exit(0);
				
			} !(p.contains(x-i)) (p.contains(x-i)) p.contains p x-i x i {
				System.out.println(x-i);
				System.exit(0);
			} System.out.println(x-i) System.out.println System.out System System.out x-i x i System.exit(0) System.exit System 0 if(!(p.contains(x+i))) {
				System.out.println(x+i);
				System.exit(0);
				
			} !(p.contains(x+i)) (p.contains(x+i)) p.contains p x+i x i {
				System.out.println(x+i);
				System.exit(0);
				
			} System.out.println(x+i) System.out.println System.out System System.out x+i x i System.exit(0) System.exit System 0 System.out.println(0) System.out.println System.out System System.out 0 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 min=0;
		int max=0;
		ArrayList p = new ArrayList<>();
		
	
		for(int i=0;i<n;i++) {
			p.add(sc.nextInt());
		}

		if(!(p.contains(x))) {
			System.out.println(x);
			System.exit(0);
		}
		
		
		for(int i=1;i<p.size();i++) {
			if(!(p.contains(x-i))) {
				System.out.println(x-i);
				System.exit(0);
			}
			else if(!(p.contains(x+i))) {
				System.out.println(x+i);
				System.exit(0);
				
			}
		}
		System.out.println(0);
		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 min=0;
		int max=0;
		ArrayList p = new ArrayList<>();
		
	
		for(int i=0;i<n;i++) {
			p.add(sc.nextInt());
		}

		if(!(p.contains(x))) {
			System.out.println(x);
			System.exit(0);
		}
		
		
		for(int i=1;i<p.size();i++) {
			if(!(p.contains(x-i))) {
				System.out.println(x-i);
				System.exit(0);
			}
			else if(!(p.contains(x+i))) {
				System.out.println(x+i);
				System.exit(0);
				
			}
		}
		System.out.println(0);
		sc.close();
	}
} Main
import 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 min=0;
		int max=0;
		ArrayList p = new ArrayList<>();
		
	
		for(int i=0;i<n;i++) {
			p.add(sc.nextInt());
		}

		if(!(p.contains(x))) {
			System.out.println(x);
			System.exit(0);
		}
		
		
		for(int i=1;i<p.size();i++) {
			if(!(p.contains(x-i))) {
				System.out.println(x-i);
				System.exit(0);
			}
			else if(!(p.contains(x+i))) {
				System.out.println(x+i);
				System.exit(0);
				
			}
		}
		System.out.println(0);
		sc.close();
	}
}
