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();
		if(n==0){
			System.out.println(x);
			System.exit(0);
		}
		int ans1=0;
		int ans2=0;
		List<Integer> l = new ArrayList<Integer>();
		for(int i = 0;i<n;i++){
			l.add(sc.nextInt());
		}
		int count = 0;
		boolean flg1 = false;
		boolean flg2 = false;
		while(!flg1&&!flg2){

			if(!l.contains(x+count)){
				flg1 = true;
				ans1 = x+count;
			}
			if(!l.contains(x-count)){
				flg2 = true;
				ans2 = x-count;
			}
          count++;
		}
		if(flg2){
			System.out.println(ans2);
		}else{
			System.out.println(ans1);
		}		
	}
} 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();
		if(n==0){
			System.out.println(x);
			System.exit(0);
		}
		int ans1=0;
		int ans2=0;
		List<Integer> l = new ArrayList<Integer>();
		for(int i = 0;i<n;i++){
			l.add(sc.nextInt());
		}
		int count = 0;
		boolean flg1 = false;
		boolean flg2 = false;
		while(!flg1&&!flg2){

			if(!l.contains(x+count)){
				flg1 = true;
				ans1 = x+count;
			}
			if(!l.contains(x-count)){
				flg2 = true;
				ans2 = x-count;
			}
          count++;
		}
		if(flg2){
			System.out.println(ans2);
		}else{
			System.out.println(ans1);
		}		
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		if(n==0){
			System.out.println(x);
			System.exit(0);
		}
		int ans1=0;
		int ans2=0;
		List<Integer> l = new ArrayList<Integer>();
		for(int i = 0;i<n;i++){
			l.add(sc.nextInt());
		}
		int count = 0;
		boolean flg1 = false;
		boolean flg2 = false;
		while(!flg1&&!flg2){

			if(!l.contains(x+count)){
				flg1 = true;
				ans1 = x+count;
			}
			if(!l.contains(x-count)){
				flg2 = true;
				ans2 = x-count;
			}
          count++;
		}
		if(flg2){
			System.out.println(ans2);
		}else{
			System.out.println(ans1);
		}		
	} main {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		if(n==0){
			System.out.println(x);
			System.exit(0);
		}
		int ans1=0;
		int ans2=0;
		List<Integer> l = new ArrayList<Integer>();
		for(int i = 0;i<n;i++){
			l.add(sc.nextInt());
		}
		int count = 0;
		boolean flg1 = false;
		boolean flg2 = false;
		while(!flg1&&!flg2){

			if(!l.contains(x+count)){
				flg1 = true;
				ans1 = x+count;
			}
			if(!l.contains(x-count)){
				flg2 = true;
				ans2 = x-count;
			}
          count++;
		}
		if(flg2){
			System.out.println(ans2);
		}else{
			System.out.println(ans1);
		}		
	} 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 if(n==0){
			System.out.println(x);
			System.exit(0);
		} n==0 n 0 {
			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 int ans1=0; ans1 0 int ans2=0; ans2 0 List<Integer> l = new ArrayList<Integer>(); l new ArrayList<Integer>() for(int i = 0;i<n;i++){
			l.add(sc.nextInt());
		} int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
			l.add(sc.nextInt());
		} {
			l.add(sc.nextInt());
		} l.add(sc.nextInt()) l.add l sc.nextInt() sc.nextInt sc int count = 0; count 0 boolean flg1 = false; flg1 false boolean flg2 = false; flg2 false while(!flg1&&!flg2){

			if(!l.contains(x+count)){
				flg1 = true;
				ans1 = x+count;
			}
			if(!l.contains(x-count)){
				flg2 = true;
				ans2 = x-count;
			}
          count++;
		} !flg1&&!flg2 !flg1 flg1 !flg2 flg2 {

			if(!l.contains(x+count)){
				flg1 = true;
				ans1 = x+count;
			}
			if(!l.contains(x-count)){
				flg2 = true;
				ans2 = x-count;
			}
          count++;
		} if(!l.contains(x+count)){
				flg1 = true;
				ans1 = x+count;
			} !l.contains(x+count) l.contains(x+count) l.contains l x+count x count {
				flg1 = true;
				ans1 = x+count;
			} flg1 = true flg1 true ans1 = x+count ans1 x+count x count if(!l.contains(x-count)){
				flg2 = true;
				ans2 = x-count;
			} !l.contains(x-count) l.contains(x-count) l.contains l x-count x count {
				flg2 = true;
				ans2 = x-count;
			} flg2 = true flg2 true ans2 = x-count ans2 x-count x count count++ count if(flg2){
			System.out.println(ans2);
		}else{
			System.out.println(ans1);
		} flg2 {
			System.out.println(ans2);
		} System.out.println(ans2) System.out.println System.out System System.out ans2 {
			System.out.println(ans1);
		} System.out.println(ans1) System.out.println System.out System System.out ans1 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();
		if(n==0){
			System.out.println(x);
			System.exit(0);
		}
		int ans1=0;
		int ans2=0;
		List<Integer> l = new ArrayList<Integer>();
		for(int i = 0;i<n;i++){
			l.add(sc.nextInt());
		}
		int count = 0;
		boolean flg1 = false;
		boolean flg2 = false;
		while(!flg1&&!flg2){

			if(!l.contains(x+count)){
				flg1 = true;
				ans1 = x+count;
			}
			if(!l.contains(x-count)){
				flg2 = true;
				ans2 = x-count;
			}
          count++;
		}
		if(flg2){
			System.out.println(ans2);
		}else{
			System.out.println(ans1);
		}		
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		if(n==0){
			System.out.println(x);
			System.exit(0);
		}
		int ans1=0;
		int ans2=0;
		List<Integer> l = new ArrayList<Integer>();
		for(int i = 0;i<n;i++){
			l.add(sc.nextInt());
		}
		int count = 0;
		boolean flg1 = false;
		boolean flg2 = false;
		while(!flg1&&!flg2){

			if(!l.contains(x+count)){
				flg1 = true;
				ans1 = x+count;
			}
			if(!l.contains(x-count)){
				flg2 = true;
				ans2 = x-count;
			}
          count++;
		}
		if(flg2){
			System.out.println(ans2);
		}else{
			System.out.println(ans1);
		}		
	}
} 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();
		if(n==0){
			System.out.println(x);
			System.exit(0);
		}
		int ans1=0;
		int ans2=0;
		List<Integer> l = new ArrayList<Integer>();
		for(int i = 0;i<n;i++){
			l.add(sc.nextInt());
		}
		int count = 0;
		boolean flg1 = false;
		boolean flg2 = false;
		while(!flg1&&!flg2){

			if(!l.contains(x+count)){
				flg1 = true;
				ans1 = x+count;
			}
			if(!l.contains(x-count)){
				flg2 = true;
				ans2 = x-count;
			}
          count++;
		}
		if(flg2){
			System.out.println(ans2);
		}else{
			System.out.println(ans1);
		}		
	}
}
