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();
		HashSet<Integer> set = new HashSet<>();
		for (int i = 0; i < n; i++) {
		    set.add(sc.nextInt());
		}
		int min = Integer.MAX_VALUE;
		int minvalue = 0;
		for (int i = x - 100; i <= x + 100; i++) {
		    if (!set.contains(i)) {
		        if (min > Math.abs(x - i)) {
		            min = Math.abs(x - i);
		            minvalue = i;
		        }
		    }
		}
	    System.out.println(minvalue);
	}
} 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();
		HashSet<Integer> set = new HashSet<>();
		for (int i = 0; i < n; i++) {
		    set.add(sc.nextInt());
		}
		int min = Integer.MAX_VALUE;
		int minvalue = 0;
		for (int i = x - 100; i <= x + 100; i++) {
		    if (!set.contains(i)) {
		        if (min > Math.abs(x - i)) {
		            min = Math.abs(x - i);
		            minvalue = i;
		        }
		    }
		}
	    System.out.println(minvalue);
	}
} Main public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		HashSet<Integer> set = new HashSet<>();
		for (int i = 0; i < n; i++) {
		    set.add(sc.nextInt());
		}
		int min = Integer.MAX_VALUE;
		int minvalue = 0;
		for (int i = x - 100; i <= x + 100; i++) {
		    if (!set.contains(i)) {
		        if (min > Math.abs(x - i)) {
		            min = Math.abs(x - i);
		            minvalue = i;
		        }
		    }
		}
	    System.out.println(minvalue);
	} main {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		HashSet<Integer> set = new HashSet<>();
		for (int i = 0; i < n; i++) {
		    set.add(sc.nextInt());
		}
		int min = Integer.MAX_VALUE;
		int minvalue = 0;
		for (int i = x - 100; i <= x + 100; i++) {
		    if (!set.contains(i)) {
		        if (min > Math.abs(x - i)) {
		            min = Math.abs(x - i);
		            minvalue = i;
		        }
		    }
		}
	    System.out.println(minvalue);
	} 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 HashSet<Integer> set = new HashSet<>(); set new HashSet<>() for (int i = 0; i < n; i++) {
		    set.add(sc.nextInt());
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
		    set.add(sc.nextInt());
		} {
		    set.add(sc.nextInt());
		} set.add(sc.nextInt()) set.add set sc.nextInt() sc.nextInt sc int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE int minvalue = 0; minvalue 0 for (int i = x - 100; i <= x + 100; i++) {
		    if (!set.contains(i)) {
		        if (min > Math.abs(x - i)) {
		            min = Math.abs(x - i);
		            minvalue = i;
		        }
		    }
		} int i = x - 100; int i = x - 100; i x - 100 x 100 i <= x + 100 i x + 100 x 100 i++ i++ i {
		    if (!set.contains(i)) {
		        if (min > Math.abs(x - i)) {
		            min = Math.abs(x - i);
		            minvalue = i;
		        }
		    }
		} {
		    if (!set.contains(i)) {
		        if (min > Math.abs(x - i)) {
		            min = Math.abs(x - i);
		            minvalue = i;
		        }
		    }
		} if (!set.contains(i)) {
		        if (min > Math.abs(x - i)) {
		            min = Math.abs(x - i);
		            minvalue = i;
		        }
		    } !set.contains(i) set.contains(i) set.contains set i {
		        if (min > Math.abs(x - i)) {
		            min = Math.abs(x - i);
		            minvalue = i;
		        }
		    } if (min > Math.abs(x - i)) {
		            min = Math.abs(x - i);
		            minvalue = i;
		        } min > Math.abs(x - i) min Math.abs(x - i) Math.abs Math x - i x i {
		            min = Math.abs(x - i);
		            minvalue = i;
		        } min = Math.abs(x - i) min Math.abs(x - i) Math.abs Math x - i x i minvalue = i minvalue i System.out.println(minvalue) System.out.println System.out System System.out minvalue 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();
		HashSet<Integer> set = new HashSet<>();
		for (int i = 0; i < n; i++) {
		    set.add(sc.nextInt());
		}
		int min = Integer.MAX_VALUE;
		int minvalue = 0;
		for (int i = x - 100; i <= x + 100; i++) {
		    if (!set.contains(i)) {
		        if (min > Math.abs(x - i)) {
		            min = Math.abs(x - i);
		            minvalue = i;
		        }
		    }
		}
	    System.out.println(minvalue);
	}
} public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		HashSet<Integer> set = new HashSet<>();
		for (int i = 0; i < n; i++) {
		    set.add(sc.nextInt());
		}
		int min = Integer.MAX_VALUE;
		int minvalue = 0;
		for (int i = x - 100; i <= x + 100; i++) {
		    if (!set.contains(i)) {
		        if (min > Math.abs(x - i)) {
		            min = Math.abs(x - i);
		            minvalue = i;
		        }
		    }
		}
	    System.out.println(minvalue);
	}
} 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();
		HashSet<Integer> set = new HashSet<>();
		for (int i = 0; i < n; i++) {
		    set.add(sc.nextInt());
		}
		int min = Integer.MAX_VALUE;
		int minvalue = 0;
		for (int i = x - 100; i <= x + 100; i++) {
		    if (!set.contains(i)) {
		        if (min > Math.abs(x - i)) {
		            min = Math.abs(x - i);
		            minvalue = i;
		        }
		    }
		}
	    System.out.println(minvalue);
	}
}
