import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;


public class Main {

	static long mod = (long)(1e+9 + 7);
	static int[] sieve;
	static ArrayList<Integer> primes;

	public static void main(String[] args) {
		fast s = new fast();
		int x = s.nextInt();
		int n = s.nextInt();

		boolean[] p = new boolean[103];
		for(int i = 0; i < n; i++) {
			int t = s.nextInt();
			p[t+1] = true;
		}

		int l = x;
		int u = x;
		int ans = x;

		if(p[x+1]) {
			while(l > -1 || u < 101){
				if(l > -1) {
					l--;
					if(!p[l+1]) {
						ans = l;
						break;
					}
				}
				if(u < 101) {
					u++;
					if(!p[u+1]) {
						ans = u;
						break;
					}
				}

			}
		}


		PrintWriter out = new PrintWriter(System.out);
		StringBuilder sb = new StringBuilder("");
		sb.append(ans);

		out.println(sb);
		out.close();
	}







	static class fast {

		   private InputStream i;
			private byte[]  buf = new byte[1024];
			private int curChar;

			private int numChars;

			//Return floor log2n
			public static long log2(long bits) // returns 0 for bits=0
				{
				    int log = 0;
				    if( ( bits & 0xffff0000 ) != 0 ) { bits >>>= 16; log = 16; }
				    if( bits >= 256 ) { bits >>>= 8; log += 8; }
				    if( bits >= 16  ) { bits >>>= 4; log += 4; }
				    if( bits >= 4   ) { bits >>>= 2; log += 2; }
				    return log + ( bits >>> 1 );
				}

			public static boolean next_permutation(int a[])
			   {
				   int i=0,j=0;int index=-1;
				   int n=a.length;

				   for(i=0;i<n-1;i++)
					   if(a[i]<a[i+1]) index=i;

				   if(index==-1) return false;
				   i=index;


				   for(j=i+1;j<n && a[i]<a[j];j++);

				   int temp=a[i];
				   a[i]=a[j-1];
				   a[j-1]=temp;

				   for(int p=i+1,q=n-1;p<q;p++,q--)
				   {
					   temp=a[p];
					   a[p]=a[q];
					   a[q]=temp;
				   }

				   return true;
			   }

			public static void sieve(int size)
			{
				sieve=new int[size+1];

				primes=new ArrayList<Integer>();

				sieve[1]=1;

				for(int i=2;i*i<=size;i++)
				{
					if(sieve[i]==0)
					 {
						for(int j=i*i;j<size;j+=i) {sieve[j]=1;}
					 }
				}

				for(int i=2;i<=size;i++)
				{
					if(sieve[i]==0) primes.add(i);
				}
			}

			public static long pow(long a, long p){
			    long o = 1;
			    for(; p>0; p>>=1){
			        if((p&1)==1)o = mul(o, a);
			        a = mul(a, a);
			    }
			    return o;
			}

			public static long add(long... a){
			    long o = 0;
			    for(long x:a)o = (o+mod+x)%mod;
			    return o;
			}

			public static long mul(long... a){
			    long p = 1;
			    for(long x:a)p = (mod+(p*x)%mod)%mod;
			    return p;
			}

			public static long mod_inv(long n)
			{
				return pow(n,mod-2);
			}

			public long gcd(long r,long ans)
			{
				if(r==0) return ans;
				return gcd(ans%r,r);
			}

			public fast() {
				this(System.in);
			}
			public fast(InputStream is) {
				i = is;
			}
			public int read() {
				if (numChars == -1)
					throw new InputMismatchException();
				if (curChar >= numChars) {
					curChar = 0;
					try {
						numChars = i.read(buf);
					} catch (IOException e) {
						throw new InputMismatchException();
					}
					if (numChars <= 0)
						return -1;
				}
				return buf[curChar++];
			}
			public String nextLine() {
				int c = read();
				while (isSpaceChar(c))
					c = read();
				StringBuilder res = new StringBuilder();
				do {
					res.appendCodePoint(c);
					c = read();
				} while (!isEndOfLine(c));
				return res.toString();
			}
			public String nextString() {
	     		int c = read();
				while (isSpaceChar(c))
					c = read();
				StringBuilder res = new StringBuilder();
				do {
					res.appendCodePoint(c);
					c = read();
				} while (!isSpaceChar(c));
				return res.toString();
			}
			public long nextLong() {
				int c = read();
				while (isSpaceChar(c))
					c = read();
				int sgn = 1;
				if (c == '-') {
					sgn = -1;
					c = read();
				}
				long res = 0;
				do {
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = read();
				} while (!isSpaceChar(c));
				return res * sgn;
			}
			public int nextInt() {
				int c = read();
				while (isSpaceChar(c))
					c = read();
				int sgn = 1;
				if (c == '-') {
					sgn = -1;
					c = read();
				}
				int res = 0;
				do {
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = read();
				} while (!isSpaceChar(c));
				return res * sgn;
			}
			public boolean isSpaceChar(int c) {
				return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
			}
			public boolean isEndOfLine(int c) {
				return c == '\n' || c == '\r' || c == -1;
			}

		}



} import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.ArrayDeque; ArrayDeque java.util import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.Collections; Collections java.util import java.util.HashMap; HashMap java.util import java.util.HashSet; HashSet java.util import java.util.InputMismatchException; InputMismatchException java.util import java.util.Iterator; Iterator java.util import java.util.List; List java.util import java.util.Map; Map java.util import java.util.Scanner; Scanner java.util import java.util.Set; Set java.util public class Main {

	static long mod = (long)(1e+9 + 7);
	static int[] sieve;
	static ArrayList<Integer> primes;

	public static void main(String[] args) {
		fast s = new fast();
		int x = s.nextInt();
		int n = s.nextInt();

		boolean[] p = new boolean[103];
		for(int i = 0; i < n; i++) {
			int t = s.nextInt();
			p[t+1] = true;
		}

		int l = x;
		int u = x;
		int ans = x;

		if(p[x+1]) {
			while(l > -1 || u < 101){
				if(l > -1) {
					l--;
					if(!p[l+1]) {
						ans = l;
						break;
					}
				}
				if(u < 101) {
					u++;
					if(!p[u+1]) {
						ans = u;
						break;
					}
				}

			}
		}


		PrintWriter out = new PrintWriter(System.out);
		StringBuilder sb = new StringBuilder("");
		sb.append(ans);

		out.println(sb);
		out.close();
	}







	static class fast {

		   private InputStream i;
			private byte[]  buf = new byte[1024];
			private int curChar;

			private int numChars;

			//Return floor log2n
			public static long log2(long bits) // returns 0 for bits=0
				{
				    int log = 0;
				    if( ( bits & 0xffff0000 ) != 0 ) { bits >>>= 16; log = 16; }
				    if( bits >= 256 ) { bits >>>= 8; log += 8; }
				    if( bits >= 16  ) { bits >>>= 4; log += 4; }
				    if( bits >= 4   ) { bits >>>= 2; log += 2; }
				    return log + ( bits >>> 1 );
				}

			public static boolean next_permutation(int a[])
			   {
				   int i=0,j=0;int index=-1;
				   int n=a.length;

				   for(i=0;i<n-1;i++)
					   if(a[i]<a[i+1]) index=i;

				   if(index==-1) return false;
				   i=index;


				   for(j=i+1;j<n && a[i]<a[j];j++);

				   int temp=a[i];
				   a[i]=a[j-1];
				   a[j-1]=temp;

				   for(int p=i+1,q=n-1;p<q;p++,q--)
				   {
					   temp=a[p];
					   a[p]=a[q];
					   a[q]=temp;
				   }

				   return true;
			   }

			public static void sieve(int size)
			{
				sieve=new int[size+1];

				primes=new ArrayList<Integer>();

				sieve[1]=1;

				for(int i=2;i*i<=size;i++)
				{
					if(sieve[i]==0)
					 {
						for(int j=i*i;j<size;j+=i) {sieve[j]=1;}
					 }
				}

				for(int i=2;i<=size;i++)
				{
					if(sieve[i]==0) primes.add(i);
				}
			}

			public static long pow(long a, long p){
			    long o = 1;
			    for(; p>0; p>>=1){
			        if((p&1)==1)o = mul(o, a);
			        a = mul(a, a);
			    }
			    return o;
			}

			public static long add(long... a){
			    long o = 0;
			    for(long x:a)o = (o+mod+x)%mod;
			    return o;
			}

			public static long mul(long... a){
			    long p = 1;
			    for(long x:a)p = (mod+(p*x)%mod)%mod;
			    return p;
			}

			public static long mod_inv(long n)
			{
				return pow(n,mod-2);
			}

			public long gcd(long r,long ans)
			{
				if(r==0) return ans;
				return gcd(ans%r,r);
			}

			public fast() {
				this(System.in);
			}
			public fast(InputStream is) {
				i = is;
			}
			public int read() {
				if (numChars == -1)
					throw new InputMismatchException();
				if (curChar >= numChars) {
					curChar = 0;
					try {
						numChars = i.read(buf);
					} catch (IOException e) {
						throw new InputMismatchException();
					}
					if (numChars <= 0)
						return -1;
				}
				return buf[curChar++];
			}
			public String nextLine() {
				int c = read();
				while (isSpaceChar(c))
					c = read();
				StringBuilder res = new StringBuilder();
				do {
					res.appendCodePoint(c);
					c = read();
				} while (!isEndOfLine(c));
				return res.toString();
			}
			public String nextString() {
	     		int c = read();
				while (isSpaceChar(c))
					c = read();
				StringBuilder res = new StringBuilder();
				do {
					res.appendCodePoint(c);
					c = read();
				} while (!isSpaceChar(c));
				return res.toString();
			}
			public long nextLong() {
				int c = read();
				while (isSpaceChar(c))
					c = read();
				int sgn = 1;
				if (c == '-') {
					sgn = -1;
					c = read();
				}
				long res = 0;
				do {
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = read();
				} while (!isSpaceChar(c));
				return res * sgn;
			}
			public int nextInt() {
				int c = read();
				while (isSpaceChar(c))
					c = read();
				int sgn = 1;
				if (c == '-') {
					sgn = -1;
					c = read();
				}
				int res = 0;
				do {
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = read();
				} while (!isSpaceChar(c));
				return res * sgn;
			}
			public boolean isSpaceChar(int c) {
				return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
			}
			public boolean isEndOfLine(int c) {
				return c == '\n' || c == '\r' || c == -1;
			}

		}



} Main static long mod = (long)(1e+9 + 7); mod (long)(1e+9 + 7) 1e+9 7 static int[] sieve; sieve static ArrayList<Integer> primes; primes public static void main(String[] args) {
		fast s = new fast();
		int x = s.nextInt();
		int n = s.nextInt();

		boolean[] p = new boolean[103];
		for(int i = 0; i < n; i++) {
			int t = s.nextInt();
			p[t+1] = true;
		}

		int l = x;
		int u = x;
		int ans = x;

		if(p[x+1]) {
			while(l > -1 || u < 101){
				if(l > -1) {
					l--;
					if(!p[l+1]) {
						ans = l;
						break;
					}
				}
				if(u < 101) {
					u++;
					if(!p[u+1]) {
						ans = u;
						break;
					}
				}

			}
		}


		PrintWriter out = new PrintWriter(System.out);
		StringBuilder sb = new StringBuilder("");
		sb.append(ans);

		out.println(sb);
		out.close();
	} main {
		fast s = new fast();
		int x = s.nextInt();
		int n = s.nextInt();

		boolean[] p = new boolean[103];
		for(int i = 0; i < n; i++) {
			int t = s.nextInt();
			p[t+1] = true;
		}

		int l = x;
		int u = x;
		int ans = x;

		if(p[x+1]) {
			while(l > -1 || u < 101){
				if(l > -1) {
					l--;
					if(!p[l+1]) {
						ans = l;
						break;
					}
				}
				if(u < 101) {
					u++;
					if(!p[u+1]) {
						ans = u;
						break;
					}
				}

			}
		}


		PrintWriter out = new PrintWriter(System.out);
		StringBuilder sb = new StringBuilder("");
		sb.append(ans);

		out.println(sb);
		out.close();
	} fast s = new fast(); s new fast() int x = s.nextInt(); x s.nextInt() s.nextInt s int n = s.nextInt(); n s.nextInt() s.nextInt s boolean[] p = new boolean[103]; p new boolean[103] 103 for(int i = 0; i < n; i++) {
			int t = s.nextInt();
			p[t+1] = true;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			int t = s.nextInt();
			p[t+1] = true;
		} {
			int t = s.nextInt();
			p[t+1] = true;
		} int t = s.nextInt(); t s.nextInt() s.nextInt s p[t+1] = true p[t+1] p t+1 t 1 true int l = x; l x int u = x; u x int ans = x; ans x if(p[x+1]) {
			while(l > -1 || u < 101){
				if(l > -1) {
					l--;
					if(!p[l+1]) {
						ans = l;
						break;
					}
				}
				if(u < 101) {
					u++;
					if(!p[u+1]) {
						ans = u;
						break;
					}
				}

			}
		} p[x+1] p x+1 x 1 {
			while(l > -1 || u < 101){
				if(l > -1) {
					l--;
					if(!p[l+1]) {
						ans = l;
						break;
					}
				}
				if(u < 101) {
					u++;
					if(!p[u+1]) {
						ans = u;
						break;
					}
				}

			}
		} while(l > -1 || u < 101){
				if(l > -1) {
					l--;
					if(!p[l+1]) {
						ans = l;
						break;
					}
				}
				if(u < 101) {
					u++;
					if(!p[u+1]) {
						ans = u;
						break;
					}
				}

			} l > -1 || u < 101 l > -1 l -1 1 u < 101 u 101 {
				if(l > -1) {
					l--;
					if(!p[l+1]) {
						ans = l;
						break;
					}
				}
				if(u < 101) {
					u++;
					if(!p[u+1]) {
						ans = u;
						break;
					}
				}

			} if(l > -1) {
					l--;
					if(!p[l+1]) {
						ans = l;
						break;
					}
				} l > -1 l -1 1 {
					l--;
					if(!p[l+1]) {
						ans = l;
						break;
					}
				} l-- l if(!p[l+1]) {
						ans = l;
						break;
					} !p[l+1] p[l+1] p l+1 l 1 {
						ans = l;
						break;
					} ans = l ans l break; if(u < 101) {
					u++;
					if(!p[u+1]) {
						ans = u;
						break;
					}
				} u < 101 u 101 {
					u++;
					if(!p[u+1]) {
						ans = u;
						break;
					}
				} u++ u if(!p[u+1]) {
						ans = u;
						break;
					} !p[u+1] p[u+1] p u+1 u 1 {
						ans = u;
						break;
					} ans = u ans u break; PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) StringBuilder sb = new StringBuilder(""); sb new StringBuilder("") sb.append(ans) sb.append sb ans out.println(sb) out.println out sb out.close() out.close out String[] args args static class fast {

		   private InputStream i;
			private byte[]  buf = new byte[1024];
			private int curChar;

			private int numChars;

			//Return floor log2n
			public static long log2(long bits) // returns 0 for bits=0
				{
				    int log = 0;
				    if( ( bits & 0xffff0000 ) != 0 ) { bits >>>= 16; log = 16; }
				    if( bits >= 256 ) { bits >>>= 8; log += 8; }
				    if( bits >= 16  ) { bits >>>= 4; log += 4; }
				    if( bits >= 4   ) { bits >>>= 2; log += 2; }
				    return log + ( bits >>> 1 );
				}

			public static boolean next_permutation(int a[])
			   {
				   int i=0,j=0;int index=-1;
				   int n=a.length;

				   for(i=0;i<n-1;i++)
					   if(a[i]<a[i+1]) index=i;

				   if(index==-1) return false;
				   i=index;


				   for(j=i+1;j<n && a[i]<a[j];j++);

				   int temp=a[i];
				   a[i]=a[j-1];
				   a[j-1]=temp;

				   for(int p=i+1,q=n-1;p<q;p++,q--)
				   {
					   temp=a[p];
					   a[p]=a[q];
					   a[q]=temp;
				   }

				   return true;
			   }

			public static void sieve(int size)
			{
				sieve=new int[size+1];

				primes=new ArrayList<Integer>();

				sieve[1]=1;

				for(int i=2;i*i<=size;i++)
				{
					if(sieve[i]==0)
					 {
						for(int j=i*i;j<size;j+=i) {sieve[j]=1;}
					 }
				}

				for(int i=2;i<=size;i++)
				{
					if(sieve[i]==0) primes.add(i);
				}
			}

			public static long pow(long a, long p){
			    long o = 1;
			    for(; p>0; p>>=1){
			        if((p&1)==1)o = mul(o, a);
			        a = mul(a, a);
			    }
			    return o;
			}

			public static long add(long... a){
			    long o = 0;
			    for(long x:a)o = (o+mod+x)%mod;
			    return o;
			}

			public static long mul(long... a){
			    long p = 1;
			    for(long x:a)p = (mod+(p*x)%mod)%mod;
			    return p;
			}

			public static long mod_inv(long n)
			{
				return pow(n,mod-2);
			}

			public long gcd(long r,long ans)
			{
				if(r==0) return ans;
				return gcd(ans%r,r);
			}

			public fast() {
				this(System.in);
			}
			public fast(InputStream is) {
				i = is;
			}
			public int read() {
				if (numChars == -1)
					throw new InputMismatchException();
				if (curChar >= numChars) {
					curChar = 0;
					try {
						numChars = i.read(buf);
					} catch (IOException e) {
						throw new InputMismatchException();
					}
					if (numChars <= 0)
						return -1;
				}
				return buf[curChar++];
			}
			public String nextLine() {
				int c = read();
				while (isSpaceChar(c))
					c = read();
				StringBuilder res = new StringBuilder();
				do {
					res.appendCodePoint(c);
					c = read();
				} while (!isEndOfLine(c));
				return res.toString();
			}
			public String nextString() {
	     		int c = read();
				while (isSpaceChar(c))
					c = read();
				StringBuilder res = new StringBuilder();
				do {
					res.appendCodePoint(c);
					c = read();
				} while (!isSpaceChar(c));
				return res.toString();
			}
			public long nextLong() {
				int c = read();
				while (isSpaceChar(c))
					c = read();
				int sgn = 1;
				if (c == '-') {
					sgn = -1;
					c = read();
				}
				long res = 0;
				do {
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = read();
				} while (!isSpaceChar(c));
				return res * sgn;
			}
			public int nextInt() {
				int c = read();
				while (isSpaceChar(c))
					c = read();
				int sgn = 1;
				if (c == '-') {
					sgn = -1;
					c = read();
				}
				int res = 0;
				do {
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = read();
				} while (!isSpaceChar(c));
				return res * sgn;
			}
			public boolean isSpaceChar(int c) {
				return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
			}
			public boolean isEndOfLine(int c) {
				return c == '\n' || c == '\r' || c == -1;
			}

		} fast private InputStream i; i private byte[]  buf = new byte[1024]; buf new byte[1024] 1024 private int curChar; curChar private int numChars; numChars //Return floor log2n
			public static long log2(long bits) // returns 0 for bits=0
				{
				    int log = 0;
				    if( ( bits & 0xffff0000 ) != 0 ) { bits >>>= 16; log = 16; }
				    if( bits >= 256 ) { bits >>>= 8; log += 8; }
				    if( bits >= 16  ) { bits >>>= 4; log += 4; }
				    if( bits >= 4   ) { bits >>>= 2; log += 2; }
				    return log + ( bits >>> 1 );
				} log2 {
				    int log = 0;
				    if( ( bits & 0xffff0000 ) != 0 ) { bits >>>= 16; log = 16; }
				    if( bits >= 256 ) { bits >>>= 8; log += 8; }
				    if( bits >= 16  ) { bits >>>= 4; log += 4; }
				    if( bits >= 4   ) { bits >>>= 2; log += 2; }
				    return log + ( bits >>> 1 );
				} int log = 0; log 0 if( ( bits & 0xffff0000 ) != 0 ) { bits >>>= 16; log = 16; } ( bits & 0xffff0000 ) != 0 ( bits & 0xffff0000 ) bits 0xffff0000 0 { bits >>>= 16; log = 16; } bits >>>= 16 bits 16 log = 16 log 16 if( bits >= 256 ) { bits >>>= 8; log += 8; } bits >= 256 bits 256 { bits >>>= 8; log += 8; } bits >>>= 8 bits 8 log += 8 log 8 if( bits >= 16  ) { bits >>>= 4; log += 4; } bits >= 16 bits 16 { bits >>>= 4; log += 4; } bits >>>= 4 bits 4 log += 4 log 4 if( bits >= 4   ) { bits >>>= 2; log += 2; } bits >= 4 bits 4 { bits >>>= 2; log += 2; } bits >>>= 2 bits 2 log += 2 log 2 return log + ( bits >>> 1 ); log + ( bits >>> 1 ) log ( bits >>> 1 ) bits 1 long bits bits public static boolean next_permutation(int a[])
			   {
				   int i=0,j=0;int index=-1;
				   int n=a.length;

				   for(i=0;i<n-1;i++)
					   if(a[i]<a[i+1]) index=i;

				   if(index==-1) return false;
				   i=index;


				   for(j=i+1;j<n && a[i]<a[j];j++);

				   int temp=a[i];
				   a[i]=a[j-1];
				   a[j-1]=temp;

				   for(int p=i+1,q=n-1;p<q;p++,q--)
				   {
					   temp=a[p];
					   a[p]=a[q];
					   a[q]=temp;
				   }

				   return true;
			   } next_permutation {
				   int i=0,j=0;int index=-1;
				   int n=a.length;

				   for(i=0;i<n-1;i++)
					   if(a[i]<a[i+1]) index=i;

				   if(index==-1) return false;
				   i=index;


				   for(j=i+1;j<n && a[i]<a[j];j++);

				   int temp=a[i];
				   a[i]=a[j-1];
				   a[j-1]=temp;

				   for(int p=i+1,q=n-1;p<q;p++,q--)
				   {
					   temp=a[p];
					   a[p]=a[q];
					   a[q]=temp;
				   }

				   return true;
			   } int i=0 i 0 j=0; j 0 int index=-1; index -1 1 int n=a.length; n a.length a a.length for(i=0;i<n-1;i++)
					   if(a[i]<a[i+1]) index=i; i=0; i=0 i 0 i<n-1 i n-1 n 1 i++ i++ i if(a[i]<a[i+1]) index=i; if(a[i]<a[i+1]) index=i; a[i]<a[i+1] a[i] a i a[i+1] a i+1 i 1 index=i index i if(index==-1) return false; index==-1 index -1 1 return false; false i=index i index for(j=i+1;j<n && a[i]<a[j];j++); j=i+1; j=i+1 j i+1 i 1 j<n && a[i]<a[j] j<n j n a[i]<a[j] a[i] a i a[j] a j j++ j++ j ; int temp=a[i]; temp a[i] a i a[i]=a[j-1] a[i] a i a[j-1] a j-1 j 1 a[j-1]=temp a[j-1] a j-1 j 1 temp for(int p=i+1,q=n-1;p<q;p++,q--)
				   {
					   temp=a[p];
					   a[p]=a[q];
					   a[q]=temp;
				   } int p=i+1,q=n-1; int p=i+1 p i+1 i 1 q=n-1; q n-1 n 1 p<q p q p++,q-- p++ p q-- q {
					   temp=a[p];
					   a[p]=a[q];
					   a[q]=temp;
				   } {
					   temp=a[p];
					   a[p]=a[q];
					   a[q]=temp;
				   } temp=a[p] temp a[p] a p a[p]=a[q] a[p] a p a[q] a q a[q]=temp a[q] a q temp return true; true int a[] a public static void sieve(int size)
			{
				sieve=new int[size+1];

				primes=new ArrayList<Integer>();

				sieve[1]=1;

				for(int i=2;i*i<=size;i++)
				{
					if(sieve[i]==0)
					 {
						for(int j=i*i;j<size;j+=i) {sieve[j]=1;}
					 }
				}

				for(int i=2;i<=size;i++)
				{
					if(sieve[i]==0) primes.add(i);
				}
			} sieve {
				sieve=new int[size+1];

				primes=new ArrayList<Integer>();

				sieve[1]=1;

				for(int i=2;i*i<=size;i++)
				{
					if(sieve[i]==0)
					 {
						for(int j=i*i;j<size;j+=i) {sieve[j]=1;}
					 }
				}

				for(int i=2;i<=size;i++)
				{
					if(sieve[i]==0) primes.add(i);
				}
			} sieve=new int[size+1] sieve new int[size+1] size+1 size 1 primes=new ArrayList<Integer>() primes new ArrayList<Integer>() sieve[1]=1 sieve[1] sieve 1 1 for(int i=2;i*i<=size;i++)
				{
					if(sieve[i]==0)
					 {
						for(int j=i*i;j<size;j+=i) {sieve[j]=1;}
					 }
				} int i=2; int i=2; i 2 i*i<=size i*i i i size i++ i++ i {
					if(sieve[i]==0)
					 {
						for(int j=i*i;j<size;j+=i) {sieve[j]=1;}
					 }
				} {
					if(sieve[i]==0)
					 {
						for(int j=i*i;j<size;j+=i) {sieve[j]=1;}
					 }
				} if(sieve[i]==0)
					 {
						for(int j=i*i;j<size;j+=i) {sieve[j]=1;}
					 } sieve[i]==0 sieve[i] sieve i 0 {
						for(int j=i*i;j<size;j+=i) {sieve[j]=1;}
					 } for(int j=i*i;j<size;j+=i) {sieve[j]=1;} int j=i*i; int j=i*i; j i*i i i j<size j size j+=i j+=i j i {sieve[j]=1;} {sieve[j]=1;} sieve[j]=1 sieve[j] sieve j 1 for(int i=2;i<=size;i++)
				{
					if(sieve[i]==0) primes.add(i);
				} int i=2; int i=2; i 2 i<=size i size i++ i++ i {
					if(sieve[i]==0) primes.add(i);
				} {
					if(sieve[i]==0) primes.add(i);
				} if(sieve[i]==0) primes.add(i); sieve[i]==0 sieve[i] sieve i 0 primes.add(i) primes.add primes i int size size public static long pow(long a, long p){
			    long o = 1;
			    for(; p>0; p>>=1){
			        if((p&1)==1)o = mul(o, a);
			        a = mul(a, a);
			    }
			    return o;
			} pow {
			    long o = 1;
			    for(; p>0; p>>=1){
			        if((p&1)==1)o = mul(o, a);
			        a = mul(a, a);
			    }
			    return o;
			} long o = 1; o 1 for(; p>0; p>>=1){
			        if((p&1)==1)o = mul(o, a);
			        a = mul(a, a);
			    } ; p>0 p 0 p>>=1 p>>=1 p 1 {
			        if((p&1)==1)o = mul(o, a);
			        a = mul(a, a);
			    } {
			        if((p&1)==1)o = mul(o, a);
			        a = mul(a, a);
			    } if((p&1)==1)o = mul(o, a); (p&1)==1 (p&1) p 1 1 o = mul(o, a) o mul(o, a) mul o a a = mul(a, a) a mul(a, a) mul a a return o; o long a a long p p public static long add(long... a){
			    long o = 0;
			    for(long x:a)o = (o+mod+x)%mod;
			    return o;
			} add {
			    long o = 0;
			    for(long x:a)o = (o+mod+x)%mod;
			    return o;
			} long o = 0; o 0 for(long x:a)o = (o+mod+x)%mod; long x a o = (o+mod+x)%mod; o = (o+mod+x)%mod o (o+mod+x)%mod (o+mod+x) o+mod+x o mod x mod return o; o long... a a public static long mul(long... a){
			    long p = 1;
			    for(long x:a)p = (mod+(p*x)%mod)%mod;
			    return p;
			} mul {
			    long p = 1;
			    for(long x:a)p = (mod+(p*x)%mod)%mod;
			    return p;
			} long p = 1; p 1 for(long x:a)p = (mod+(p*x)%mod)%mod; long x a p = (mod+(p*x)%mod)%mod; p = (mod+(p*x)%mod)%mod p (mod+(p*x)%mod)%mod (mod+(p*x)%mod) mod (p*x)%mod (p*x) p x mod mod return p; p long... a a public static long mod_inv(long n)
			{
				return pow(n,mod-2);
			} mod_inv {
				return pow(n,mod-2);
			} return pow(n,mod-2); pow(n,mod-2) pow n mod-2 mod 2 long n n public long gcd(long r,long ans)
			{
				if(r==0) return ans;
				return gcd(ans%r,r);
			} gcd {
				if(r==0) return ans;
				return gcd(ans%r,r);
			} if(r==0) return ans; r==0 r 0 return ans; ans return gcd(ans%r,r); gcd(ans%r,r) gcd ans%r ans r r long r r long ans ans public fast() {
				this(System.in);
			} fast {
				this(System.in);
			} this(System.in) this System.in System System.in public fast(InputStream is) {
				i = is;
			} fast {
				i = is;
			} i = is i is InputStream is is public int read() {
				if (numChars == -1)
					throw new InputMismatchException();
				if (curChar >= numChars) {
					curChar = 0;
					try {
						numChars = i.read(buf);
					} catch (IOException e) {
						throw new InputMismatchException();
					}
					if (numChars <= 0)
						return -1;
				}
				return buf[curChar++];
			} read {
				if (numChars == -1)
					throw new InputMismatchException();
				if (curChar >= numChars) {
					curChar = 0;
					try {
						numChars = i.read(buf);
					} catch (IOException e) {
						throw new InputMismatchException();
					}
					if (numChars <= 0)
						return -1;
				}
				return buf[curChar++];
			} if (numChars == -1)
					throw new InputMismatchException(); numChars == -1 numChars -1 1 throw new InputMismatchException(); new InputMismatchException() if (curChar >= numChars) {
					curChar = 0;
					try {
						numChars = i.read(buf);
					} catch (IOException e) {
						throw new InputMismatchException();
					}
					if (numChars <= 0)
						return -1;
				} curChar >= numChars curChar numChars {
					curChar = 0;
					try {
						numChars = i.read(buf);
					} catch (IOException e) {
						throw new InputMismatchException();
					}
					if (numChars <= 0)
						return -1;
				} curChar = 0 curChar 0 try {
						numChars = i.read(buf);
					} catch (IOException e) {
						throw new InputMismatchException();
					} catch (IOException e) {
						throw new InputMismatchException();
					} IOException e {
						throw new InputMismatchException();
					} throw new InputMismatchException(); new InputMismatchException() {
						numChars = i.read(buf);
					} numChars = i.read(buf) numChars i.read(buf) i.read i buf if (numChars <= 0)
						return -1; numChars <= 0 numChars 0 return -1; -1 1 return buf[curChar++]; buf[curChar++] buf curChar++ curChar public String nextLine() {
				int c = read();
				while (isSpaceChar(c))
					c = read();
				StringBuilder res = new StringBuilder();
				do {
					res.appendCodePoint(c);
					c = read();
				} while (!isEndOfLine(c));
				return res.toString();
			} nextLine {
				int c = read();
				while (isSpaceChar(c))
					c = read();
				StringBuilder res = new StringBuilder();
				do {
					res.appendCodePoint(c);
					c = read();
				} while (!isEndOfLine(c));
				return res.toString();
			} int c = read(); c read() read while (isSpaceChar(c))
					c = read(); isSpaceChar(c) isSpaceChar c c = read() c read() read StringBuilder res = new StringBuilder(); res new StringBuilder() do {
					res.appendCodePoint(c);
					c = read();
				} while (!isEndOfLine(c)); !isEndOfLine(c) isEndOfLine(c) isEndOfLine c {
					res.appendCodePoint(c);
					c = read();
				} res.appendCodePoint(c) res.appendCodePoint res c c = read() c read() read return res.toString(); res.toString() res.toString res public String nextString() {
	     		int c = read();
				while (isSpaceChar(c))
					c = read();
				StringBuilder res = new StringBuilder();
				do {
					res.appendCodePoint(c);
					c = read();
				} while (!isSpaceChar(c));
				return res.toString();
			} nextString {
	     		int c = read();
				while (isSpaceChar(c))
					c = read();
				StringBuilder res = new StringBuilder();
				do {
					res.appendCodePoint(c);
					c = read();
				} while (!isSpaceChar(c));
				return res.toString();
			} int c = read(); c read() read while (isSpaceChar(c))
					c = read(); isSpaceChar(c) isSpaceChar c c = read() c read() read StringBuilder res = new StringBuilder(); res new StringBuilder() do {
					res.appendCodePoint(c);
					c = read();
				} while (!isSpaceChar(c)); !isSpaceChar(c) isSpaceChar(c) isSpaceChar c {
					res.appendCodePoint(c);
					c = read();
				} res.appendCodePoint(c) res.appendCodePoint res c c = read() c read() read return res.toString(); res.toString() res.toString res public long nextLong() {
				int c = read();
				while (isSpaceChar(c))
					c = read();
				int sgn = 1;
				if (c == '-') {
					sgn = -1;
					c = read();
				}
				long res = 0;
				do {
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = read();
				} while (!isSpaceChar(c));
				return res * sgn;
			} nextLong {
				int c = read();
				while (isSpaceChar(c))
					c = read();
				int sgn = 1;
				if (c == '-') {
					sgn = -1;
					c = read();
				}
				long res = 0;
				do {
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = read();
				} while (!isSpaceChar(c));
				return res * sgn;
			} int c = read(); c read() read while (isSpaceChar(c))
					c = read(); isSpaceChar(c) isSpaceChar c c = read() c read() read int sgn = 1; sgn 1 if (c == '-') {
					sgn = -1;
					c = read();
				} c == '-' c '-' {
					sgn = -1;
					c = read();
				} sgn = -1 sgn -1 1 c = read() c read() read long res = 0; res 0 do {
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = read();
				} while (!isSpaceChar(c)); !isSpaceChar(c) isSpaceChar(c) isSpaceChar c {
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = read();
				} if (c < '0' || c > '9')
						throw new InputMismatchException(); c < '0' || c > '9' c < '0' c '0' c > '9' c '9' throw new InputMismatchException(); new InputMismatchException() res *= 10 res 10 res += c - '0' res c - '0' c '0' c = read() c read() read return res * sgn; res * sgn res sgn public int nextInt() {
				int c = read();
				while (isSpaceChar(c))
					c = read();
				int sgn = 1;
				if (c == '-') {
					sgn = -1;
					c = read();
				}
				int res = 0;
				do {
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = read();
				} while (!isSpaceChar(c));
				return res * sgn;
			} nextInt {
				int c = read();
				while (isSpaceChar(c))
					c = read();
				int sgn = 1;
				if (c == '-') {
					sgn = -1;
					c = read();
				}
				int res = 0;
				do {
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = read();
				} while (!isSpaceChar(c));
				return res * sgn;
			} int c = read(); c read() read while (isSpaceChar(c))
					c = read(); isSpaceChar(c) isSpaceChar c c = read() c read() read int sgn = 1; sgn 1 if (c == '-') {
					sgn = -1;
					c = read();
				} c == '-' c '-' {
					sgn = -1;
					c = read();
				} sgn = -1 sgn -1 1 c = read() c read() read int res = 0; res 0 do {
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = read();
				} while (!isSpaceChar(c)); !isSpaceChar(c) isSpaceChar(c) isSpaceChar c {
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = read();
				} if (c < '0' || c > '9')
						throw new InputMismatchException(); c < '0' || c > '9' c < '0' c '0' c > '9' c '9' throw new InputMismatchException(); new InputMismatchException() res *= 10 res 10 res += c - '0' res c - '0' c '0' c = read() c read() read return res * sgn; res * sgn res sgn public boolean isSpaceChar(int c) {
				return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
			} isSpaceChar {
				return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
			} return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1 c == '\t' c == '\r' c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1 c == ' ' c ' ' c == '\n' c '\n' c == '\r' c '\r' c == '\t' c '\t' c == -1 c -1 1 int c c public boolean isEndOfLine(int c) {
				return c == '\n' || c == '\r' || c == -1;
			} isEndOfLine {
				return c == '\n' || c == '\r' || c == -1;
			} return c == '\n' || c == '\r' || c == -1; c == '\n' || c == '\r' || c == -1 c == '\n' || c == '\r' || c == -1 c == '\n' c '\n' c == '\r' c '\r' c == -1 c -1 1 int c c public class Main {

	static long mod = (long)(1e+9 + 7);
	static int[] sieve;
	static ArrayList<Integer> primes;

	public static void main(String[] args) {
		fast s = new fast();
		int x = s.nextInt();
		int n = s.nextInt();

		boolean[] p = new boolean[103];
		for(int i = 0; i < n; i++) {
			int t = s.nextInt();
			p[t+1] = true;
		}

		int l = x;
		int u = x;
		int ans = x;

		if(p[x+1]) {
			while(l > -1 || u < 101){
				if(l > -1) {
					l--;
					if(!p[l+1]) {
						ans = l;
						break;
					}
				}
				if(u < 101) {
					u++;
					if(!p[u+1]) {
						ans = u;
						break;
					}
				}

			}
		}


		PrintWriter out = new PrintWriter(System.out);
		StringBuilder sb = new StringBuilder("");
		sb.append(ans);

		out.println(sb);
		out.close();
	}







	static class fast {

		   private InputStream i;
			private byte[]  buf = new byte[1024];
			private int curChar;

			private int numChars;

			//Return floor log2n
			public static long log2(long bits) // returns 0 for bits=0
				{
				    int log = 0;
				    if( ( bits & 0xffff0000 ) != 0 ) { bits >>>= 16; log = 16; }
				    if( bits >= 256 ) { bits >>>= 8; log += 8; }
				    if( bits >= 16  ) { bits >>>= 4; log += 4; }
				    if( bits >= 4   ) { bits >>>= 2; log += 2; }
				    return log + ( bits >>> 1 );
				}

			public static boolean next_permutation(int a[])
			   {
				   int i=0,j=0;int index=-1;
				   int n=a.length;

				   for(i=0;i<n-1;i++)
					   if(a[i]<a[i+1]) index=i;

				   if(index==-1) return false;
				   i=index;


				   for(j=i+1;j<n && a[i]<a[j];j++);

				   int temp=a[i];
				   a[i]=a[j-1];
				   a[j-1]=temp;

				   for(int p=i+1,q=n-1;p<q;p++,q--)
				   {
					   temp=a[p];
					   a[p]=a[q];
					   a[q]=temp;
				   }

				   return true;
			   }

			public static void sieve(int size)
			{
				sieve=new int[size+1];

				primes=new ArrayList<Integer>();

				sieve[1]=1;

				for(int i=2;i*i<=size;i++)
				{
					if(sieve[i]==0)
					 {
						for(int j=i*i;j<size;j+=i) {sieve[j]=1;}
					 }
				}

				for(int i=2;i<=size;i++)
				{
					if(sieve[i]==0) primes.add(i);
				}
			}

			public static long pow(long a, long p){
			    long o = 1;
			    for(; p>0; p>>=1){
			        if((p&1)==1)o = mul(o, a);
			        a = mul(a, a);
			    }
			    return o;
			}

			public static long add(long... a){
			    long o = 0;
			    for(long x:a)o = (o+mod+x)%mod;
			    return o;
			}

			public static long mul(long... a){
			    long p = 1;
			    for(long x:a)p = (mod+(p*x)%mod)%mod;
			    return p;
			}

			public static long mod_inv(long n)
			{
				return pow(n,mod-2);
			}

			public long gcd(long r,long ans)
			{
				if(r==0) return ans;
				return gcd(ans%r,r);
			}

			public fast() {
				this(System.in);
			}
			public fast(InputStream is) {
				i = is;
			}
			public int read() {
				if (numChars == -1)
					throw new InputMismatchException();
				if (curChar >= numChars) {
					curChar = 0;
					try {
						numChars = i.read(buf);
					} catch (IOException e) {
						throw new InputMismatchException();
					}
					if (numChars <= 0)
						return -1;
				}
				return buf[curChar++];
			}
			public String nextLine() {
				int c = read();
				while (isSpaceChar(c))
					c = read();
				StringBuilder res = new StringBuilder();
				do {
					res.appendCodePoint(c);
					c = read();
				} while (!isEndOfLine(c));
				return res.toString();
			}
			public String nextString() {
	     		int c = read();
				while (isSpaceChar(c))
					c = read();
				StringBuilder res = new StringBuilder();
				do {
					res.appendCodePoint(c);
					c = read();
				} while (!isSpaceChar(c));
				return res.toString();
			}
			public long nextLong() {
				int c = read();
				while (isSpaceChar(c))
					c = read();
				int sgn = 1;
				if (c == '-') {
					sgn = -1;
					c = read();
				}
				long res = 0;
				do {
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = read();
				} while (!isSpaceChar(c));
				return res * sgn;
			}
			public int nextInt() {
				int c = read();
				while (isSpaceChar(c))
					c = read();
				int sgn = 1;
				if (c == '-') {
					sgn = -1;
					c = read();
				}
				int res = 0;
				do {
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = read();
				} while (!isSpaceChar(c));
				return res * sgn;
			}
			public boolean isSpaceChar(int c) {
				return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
			}
			public boolean isEndOfLine(int c) {
				return c == '\n' || c == '\r' || c == -1;
			}

		}



} public class Main {

	static long mod = (long)(1e+9 + 7);
	static int[] sieve;
	static ArrayList<Integer> primes;

	public static void main(String[] args) {
		fast s = new fast();
		int x = s.nextInt();
		int n = s.nextInt();

		boolean[] p = new boolean[103];
		for(int i = 0; i < n; i++) {
			int t = s.nextInt();
			p[t+1] = true;
		}

		int l = x;
		int u = x;
		int ans = x;

		if(p[x+1]) {
			while(l > -1 || u < 101){
				if(l > -1) {
					l--;
					if(!p[l+1]) {
						ans = l;
						break;
					}
				}
				if(u < 101) {
					u++;
					if(!p[u+1]) {
						ans = u;
						break;
					}
				}

			}
		}


		PrintWriter out = new PrintWriter(System.out);
		StringBuilder sb = new StringBuilder("");
		sb.append(ans);

		out.println(sb);
		out.close();
	}







	static class fast {

		   private InputStream i;
			private byte[]  buf = new byte[1024];
			private int curChar;

			private int numChars;

			//Return floor log2n
			public static long log2(long bits) // returns 0 for bits=0
				{
				    int log = 0;
				    if( ( bits & 0xffff0000 ) != 0 ) { bits >>>= 16; log = 16; }
				    if( bits >= 256 ) { bits >>>= 8; log += 8; }
				    if( bits >= 16  ) { bits >>>= 4; log += 4; }
				    if( bits >= 4   ) { bits >>>= 2; log += 2; }
				    return log + ( bits >>> 1 );
				}

			public static boolean next_permutation(int a[])
			   {
				   int i=0,j=0;int index=-1;
				   int n=a.length;

				   for(i=0;i<n-1;i++)
					   if(a[i]<a[i+1]) index=i;

				   if(index==-1) return false;
				   i=index;


				   for(j=i+1;j<n && a[i]<a[j];j++);

				   int temp=a[i];
				   a[i]=a[j-1];
				   a[j-1]=temp;

				   for(int p=i+1,q=n-1;p<q;p++,q--)
				   {
					   temp=a[p];
					   a[p]=a[q];
					   a[q]=temp;
				   }

				   return true;
			   }

			public static void sieve(int size)
			{
				sieve=new int[size+1];

				primes=new ArrayList<Integer>();

				sieve[1]=1;

				for(int i=2;i*i<=size;i++)
				{
					if(sieve[i]==0)
					 {
						for(int j=i*i;j<size;j+=i) {sieve[j]=1;}
					 }
				}

				for(int i=2;i<=size;i++)
				{
					if(sieve[i]==0) primes.add(i);
				}
			}

			public static long pow(long a, long p){
			    long o = 1;
			    for(; p>0; p>>=1){
			        if((p&1)==1)o = mul(o, a);
			        a = mul(a, a);
			    }
			    return o;
			}

			public static long add(long... a){
			    long o = 0;
			    for(long x:a)o = (o+mod+x)%mod;
			    return o;
			}

			public static long mul(long... a){
			    long p = 1;
			    for(long x:a)p = (mod+(p*x)%mod)%mod;
			    return p;
			}

			public static long mod_inv(long n)
			{
				return pow(n,mod-2);
			}

			public long gcd(long r,long ans)
			{
				if(r==0) return ans;
				return gcd(ans%r,r);
			}

			public fast() {
				this(System.in);
			}
			public fast(InputStream is) {
				i = is;
			}
			public int read() {
				if (numChars == -1)
					throw new InputMismatchException();
				if (curChar >= numChars) {
					curChar = 0;
					try {
						numChars = i.read(buf);
					} catch (IOException e) {
						throw new InputMismatchException();
					}
					if (numChars <= 0)
						return -1;
				}
				return buf[curChar++];
			}
			public String nextLine() {
				int c = read();
				while (isSpaceChar(c))
					c = read();
				StringBuilder res = new StringBuilder();
				do {
					res.appendCodePoint(c);
					c = read();
				} while (!isEndOfLine(c));
				return res.toString();
			}
			public String nextString() {
	     		int c = read();
				while (isSpaceChar(c))
					c = read();
				StringBuilder res = new StringBuilder();
				do {
					res.appendCodePoint(c);
					c = read();
				} while (!isSpaceChar(c));
				return res.toString();
			}
			public long nextLong() {
				int c = read();
				while (isSpaceChar(c))
					c = read();
				int sgn = 1;
				if (c == '-') {
					sgn = -1;
					c = read();
				}
				long res = 0;
				do {
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = read();
				} while (!isSpaceChar(c));
				return res * sgn;
			}
			public int nextInt() {
				int c = read();
				while (isSpaceChar(c))
					c = read();
				int sgn = 1;
				if (c == '-') {
					sgn = -1;
					c = read();
				}
				int res = 0;
				do {
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = read();
				} while (!isSpaceChar(c));
				return res * sgn;
			}
			public boolean isSpaceChar(int c) {
				return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
			}
			public boolean isEndOfLine(int c) {
				return c == '\n' || c == '\r' || c == -1;
			}

		}



} Main
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;


public class Main {

	static long mod = (long)(1e+9 + 7);
	static int[] sieve;
	static ArrayList<Integer> primes;

	public static void main(String[] args) {
		fast s = new fast();
		int x = s.nextInt();
		int n = s.nextInt();

		boolean[] p = new boolean[103];
		for(int i = 0; i < n; i++) {
			int t = s.nextInt();
			p[t+1] = true;
		}

		int l = x;
		int u = x;
		int ans = x;

		if(p[x+1]) {
			while(l > -1 || u < 101){
				if(l > -1) {
					l--;
					if(!p[l+1]) {
						ans = l;
						break;
					}
				}
				if(u < 101) {
					u++;
					if(!p[u+1]) {
						ans = u;
						break;
					}
				}

			}
		}


		PrintWriter out = new PrintWriter(System.out);
		StringBuilder sb = new StringBuilder("");
		sb.append(ans);

		out.println(sb);
		out.close();
	}







	static class fast {

		   private InputStream i;
			private byte[]  buf = new byte[1024];
			private int curChar;

			private int numChars;

			//Return floor log2n
			public static long log2(long bits) // returns 0 for bits=0
				{
				    int log = 0;
				    if( ( bits & 0xffff0000 ) != 0 ) { bits >>>= 16; log = 16; }
				    if( bits >= 256 ) { bits >>>= 8; log += 8; }
				    if( bits >= 16  ) { bits >>>= 4; log += 4; }
				    if( bits >= 4   ) { bits >>>= 2; log += 2; }
				    return log + ( bits >>> 1 );
				}

			public static boolean next_permutation(int a[])
			   {
				   int i=0,j=0;int index=-1;
				   int n=a.length;

				   for(i=0;i<n-1;i++)
					   if(a[i]<a[i+1]) index=i;

				   if(index==-1) return false;
				   i=index;


				   for(j=i+1;j<n && a[i]<a[j];j++);

				   int temp=a[i];
				   a[i]=a[j-1];
				   a[j-1]=temp;

				   for(int p=i+1,q=n-1;p<q;p++,q--)
				   {
					   temp=a[p];
					   a[p]=a[q];
					   a[q]=temp;
				   }

				   return true;
			   }

			public static void sieve(int size)
			{
				sieve=new int[size+1];

				primes=new ArrayList<Integer>();

				sieve[1]=1;

				for(int i=2;i*i<=size;i++)
				{
					if(sieve[i]==0)
					 {
						for(int j=i*i;j<size;j+=i) {sieve[j]=1;}
					 }
				}

				for(int i=2;i<=size;i++)
				{
					if(sieve[i]==0) primes.add(i);
				}
			}

			public static long pow(long a, long p){
			    long o = 1;
			    for(; p>0; p>>=1){
			        if((p&1)==1)o = mul(o, a);
			        a = mul(a, a);
			    }
			    return o;
			}

			public static long add(long... a){
			    long o = 0;
			    for(long x:a)o = (o+mod+x)%mod;
			    return o;
			}

			public static long mul(long... a){
			    long p = 1;
			    for(long x:a)p = (mod+(p*x)%mod)%mod;
			    return p;
			}

			public static long mod_inv(long n)
			{
				return pow(n,mod-2);
			}

			public long gcd(long r,long ans)
			{
				if(r==0) return ans;
				return gcd(ans%r,r);
			}

			public fast() {
				this(System.in);
			}
			public fast(InputStream is) {
				i = is;
			}
			public int read() {
				if (numChars == -1)
					throw new InputMismatchException();
				if (curChar >= numChars) {
					curChar = 0;
					try {
						numChars = i.read(buf);
					} catch (IOException e) {
						throw new InputMismatchException();
					}
					if (numChars <= 0)
						return -1;
				}
				return buf[curChar++];
			}
			public String nextLine() {
				int c = read();
				while (isSpaceChar(c))
					c = read();
				StringBuilder res = new StringBuilder();
				do {
					res.appendCodePoint(c);
					c = read();
				} while (!isEndOfLine(c));
				return res.toString();
			}
			public String nextString() {
	     		int c = read();
				while (isSpaceChar(c))
					c = read();
				StringBuilder res = new StringBuilder();
				do {
					res.appendCodePoint(c);
					c = read();
				} while (!isSpaceChar(c));
				return res.toString();
			}
			public long nextLong() {
				int c = read();
				while (isSpaceChar(c))
					c = read();
				int sgn = 1;
				if (c == '-') {
					sgn = -1;
					c = read();
				}
				long res = 0;
				do {
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = read();
				} while (!isSpaceChar(c));
				return res * sgn;
			}
			public int nextInt() {
				int c = read();
				while (isSpaceChar(c))
					c = read();
				int sgn = 1;
				if (c == '-') {
					sgn = -1;
					c = read();
				}
				int res = 0;
				do {
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					res *= 10;
					res += c - '0';
					c = read();
				} while (!isSpaceChar(c));
				return res * sgn;
			}
			public boolean isSpaceChar(int c) {
				return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
			}
			public boolean isEndOfLine(int c) {
				return c == '\n' || c == '\r' || c == -1;
			}

		}



}
