import java.util.*;
 
public class Main {
	public static void main(String[] args) throws Exception{
		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();
        }
        if(n == 0){
        	System.out.println(x);
            return;
        }
        for(int i = 0; i < n; i++){
        	int countm = 0;
            int countp = 0;
            for(int j = 0; j < n; j++){
            	if(x - i != p[j]){
                	countm++;
                }
                if(x + i != p[j]){
                	countp++;
                }
            }
            if(countm == n){
            	System.out.println(x - i);
                return;
            }else if(countp == n){
            	System.out.println(x + i);
                return;
            }
        }
        System.out.println(x - 1);
    }
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) throws Exception{
		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();
        }
        if(n == 0){
        	System.out.println(x);
            return;
        }
        for(int i = 0; i < n; i++){
        	int countm = 0;
            int countp = 0;
            for(int j = 0; j < n; j++){
            	if(x - i != p[j]){
                	countm++;
                }
                if(x + i != p[j]){
                	countp++;
                }
            }
            if(countm == n){
            	System.out.println(x - i);
                return;
            }else if(countp == n){
            	System.out.println(x + i);
                return;
            }
        }
        System.out.println(x - 1);
    }
} Main public static void main(String[] args) throws Exception{
		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();
        }
        if(n == 0){
        	System.out.println(x);
            return;
        }
        for(int i = 0; i < n; i++){
        	int countm = 0;
            int countp = 0;
            for(int j = 0; j < n; j++){
            	if(x - i != p[j]){
                	countm++;
                }
                if(x + i != p[j]){
                	countp++;
                }
            }
            if(countm == n){
            	System.out.println(x - i);
                return;
            }else if(countp == n){
            	System.out.println(x + i);
                return;
            }
        }
        System.out.println(x - 1);
    } 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();
        }
        if(n == 0){
        	System.out.println(x);
            return;
        }
        for(int i = 0; i < n; i++){
        	int countm = 0;
            int countp = 0;
            for(int j = 0; j < n; j++){
            	if(x - i != p[j]){
                	countm++;
                }
                if(x + i != p[j]){
                	countp++;
                }
            }
            if(countm == n){
            	System.out.println(x - i);
                return;
            }else if(countp == n){
            	System.out.println(x + i);
                return;
            }
        }
        System.out.println(x - 1);
    } 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 if(n == 0){
        	System.out.println(x);
            return;
        } n == 0 n 0 {
        	System.out.println(x);
            return;
        } System.out.println(x) System.out.println System.out System System.out x return; for(int i = 0; i < n; i++){
        	int countm = 0;
            int countp = 0;
            for(int j = 0; j < n; j++){
            	if(x - i != p[j]){
                	countm++;
                }
                if(x + i != p[j]){
                	countp++;
                }
            }
            if(countm == n){
            	System.out.println(x - i);
                return;
            }else if(countp == n){
            	System.out.println(x + i);
                return;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
        	int countm = 0;
            int countp = 0;
            for(int j = 0; j < n; j++){
            	if(x - i != p[j]){
                	countm++;
                }
                if(x + i != p[j]){
                	countp++;
                }
            }
            if(countm == n){
            	System.out.println(x - i);
                return;
            }else if(countp == n){
            	System.out.println(x + i);
                return;
            }
        } {
        	int countm = 0;
            int countp = 0;
            for(int j = 0; j < n; j++){
            	if(x - i != p[j]){
                	countm++;
                }
                if(x + i != p[j]){
                	countp++;
                }
            }
            if(countm == n){
            	System.out.println(x - i);
                return;
            }else if(countp == n){
            	System.out.println(x + i);
                return;
            }
        } int countm = 0; countm 0 int countp = 0; countp 0 for(int j = 0; j < n; j++){
            	if(x - i != p[j]){
                	countm++;
                }
                if(x + i != p[j]){
                	countp++;
                }
            } int j = 0; int j = 0; j 0 j < n j n j++ j++ j {
            	if(x - i != p[j]){
                	countm++;
                }
                if(x + i != p[j]){
                	countp++;
                }
            } {
            	if(x - i != p[j]){
                	countm++;
                }
                if(x + i != p[j]){
                	countp++;
                }
            } if(x - i != p[j]){
                	countm++;
                } x - i != p[j] x - i x i p[j] p j {
                	countm++;
                } countm++ countm if(x + i != p[j]){
                	countp++;
                } x + i != p[j] x + i x i p[j] p j {
                	countp++;
                } countp++ countp if(countm == n){
            	System.out.println(x - i);
                return;
            }else if(countp == n){
            	System.out.println(x + i);
                return;
            } countm == n countm n {
            	System.out.println(x - i);
                return;
            } System.out.println(x - i) System.out.println System.out System System.out x - i x i return; if(countp == n){
            	System.out.println(x + i);
                return;
            } countp == n countp n {
            	System.out.println(x + i);
                return;
            } System.out.println(x + i) System.out.println System.out System System.out x + i x i return; System.out.println(x - 1) System.out.println System.out System System.out x - 1 x 1 String[] args args public class Main {
	public static void main(String[] args) throws Exception{
		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();
        }
        if(n == 0){
        	System.out.println(x);
            return;
        }
        for(int i = 0; i < n; i++){
        	int countm = 0;
            int countp = 0;
            for(int j = 0; j < n; j++){
            	if(x - i != p[j]){
                	countm++;
                }
                if(x + i != p[j]){
                	countp++;
                }
            }
            if(countm == n){
            	System.out.println(x - i);
                return;
            }else if(countp == n){
            	System.out.println(x + i);
                return;
            }
        }
        System.out.println(x - 1);
    }
} public class Main {
	public static void main(String[] args) throws Exception{
		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();
        }
        if(n == 0){
        	System.out.println(x);
            return;
        }
        for(int i = 0; i < n; i++){
        	int countm = 0;
            int countp = 0;
            for(int j = 0; j < n; j++){
            	if(x - i != p[j]){
                	countm++;
                }
                if(x + i != p[j]){
                	countp++;
                }
            }
            if(countm == n){
            	System.out.println(x - i);
                return;
            }else if(countp == n){
            	System.out.println(x + i);
                return;
            }
        }
        System.out.println(x - 1);
    }
} Main
import java.util.*;
 
public class Main {
	public static void main(String[] args) throws Exception{
		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();
        }
        if(n == 0){
        	System.out.println(x);
            return;
        }
        for(int i = 0; i < n; i++){
        	int countm = 0;
            int countp = 0;
            for(int j = 0; j < n; j++){
            	if(x - i != p[j]){
                	countm++;
                }
                if(x + i != p[j]){
                	countp++;
                }
            }
            if(countm == n){
            	System.out.println(x - i);
                return;
            }else if(countp == n){
            	System.out.println(x + i);
                return;
            }
        }
        System.out.println(x - 1);
    }
}