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 ps[] = new int[n];
      	int ans;
      	int istack;
      
      	for(int i = 0;i < n;i++){
          istack = sc.nextInt();
          if(istack < x) ps[i] = Math.abs(x-istack)*2;
          else ps[i] = Math.abs(x-istack)*2+1;
        }
      
      	Arrays.sort(ps);
      	ans = 1;
      	for(int i = 0;i < n;i++){
          if(ps[i] == ans) ans++;
          else break;
    	}
      	if(ans%2 == 0) x -= ans/2;
      	else x += ans/2;
            
      	System.out.println(x);
      
	}
} 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 ps[] = new int[n];
      	int ans;
      	int istack;
      
      	for(int i = 0;i < n;i++){
          istack = sc.nextInt();
          if(istack < x) ps[i] = Math.abs(x-istack)*2;
          else ps[i] = Math.abs(x-istack)*2+1;
        }
      
      	Arrays.sort(ps);
      	ans = 1;
      	for(int i = 0;i < n;i++){
          if(ps[i] == ans) ans++;
          else break;
    	}
      	if(ans%2 == 0) x -= ans/2;
      	else x += ans/2;
            
      	System.out.println(x);
      
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
      	int x = sc.nextInt();
        int n = sc.nextInt();
      	int ps[] = new int[n];
      	int ans;
      	int istack;
      
      	for(int i = 0;i < n;i++){
          istack = sc.nextInt();
          if(istack < x) ps[i] = Math.abs(x-istack)*2;
          else ps[i] = Math.abs(x-istack)*2+1;
        }
      
      	Arrays.sort(ps);
      	ans = 1;
      	for(int i = 0;i < n;i++){
          if(ps[i] == ans) ans++;
          else break;
    	}
      	if(ans%2 == 0) x -= ans/2;
      	else x += ans/2;
            
      	System.out.println(x);
      
	} main {
		Scanner sc = new Scanner(System.in);
		
      	int x = sc.nextInt();
        int n = sc.nextInt();
      	int ps[] = new int[n];
      	int ans;
      	int istack;
      
      	for(int i = 0;i < n;i++){
          istack = sc.nextInt();
          if(istack < x) ps[i] = Math.abs(x-istack)*2;
          else ps[i] = Math.abs(x-istack)*2+1;
        }
      
      	Arrays.sort(ps);
      	ans = 1;
      	for(int i = 0;i < n;i++){
          if(ps[i] == ans) ans++;
          else break;
    	}
      	if(ans%2 == 0) x -= ans/2;
      	else x += ans/2;
            
      	System.out.println(x);
      
	} 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 ps[] = new int[n]; ps new int[n] n int ans; ans int istack; istack for(int i = 0;i < n;i++){
          istack = sc.nextInt();
          if(istack < x) ps[i] = Math.abs(x-istack)*2;
          else ps[i] = Math.abs(x-istack)*2+1;
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
          istack = sc.nextInt();
          if(istack < x) ps[i] = Math.abs(x-istack)*2;
          else ps[i] = Math.abs(x-istack)*2+1;
        } {
          istack = sc.nextInt();
          if(istack < x) ps[i] = Math.abs(x-istack)*2;
          else ps[i] = Math.abs(x-istack)*2+1;
        } istack = sc.nextInt() istack sc.nextInt() sc.nextInt sc if(istack < x) ps[i] = Math.abs(x-istack)*2;
          else ps[i] = Math.abs(x-istack)*2+1; istack < x istack x ps[i] = Math.abs(x-istack)*2 ps[i] ps i Math.abs(x-istack)*2 Math.abs(x-istack) Math.abs Math x-istack x istack 2 ps[i] = Math.abs(x-istack)*2+1 ps[i] ps i Math.abs(x-istack)*2+1 Math.abs(x-istack)*2 Math.abs(x-istack) Math.abs Math x-istack x istack 2 1 Arrays.sort(ps) Arrays.sort Arrays ps ans = 1 ans 1 for(int i = 0;i < n;i++){
          if(ps[i] == ans) ans++;
          else break;
    	} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
          if(ps[i] == ans) ans++;
          else break;
    	} {
          if(ps[i] == ans) ans++;
          else break;
    	} if(ps[i] == ans) ans++;
          else break; ps[i] == ans ps[i] ps i ans ans++ ans break; if(ans%2 == 0) x -= ans/2;
      	else x += ans/2; ans%2 == 0 ans%2 ans 2 0 x -= ans/2 x ans/2 ans 2 x += ans/2 x ans/2 ans 2 System.out.println(x) System.out.println System.out System System.out x 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 ps[] = new int[n];
      	int ans;
      	int istack;
      
      	for(int i = 0;i < n;i++){
          istack = sc.nextInt();
          if(istack < x) ps[i] = Math.abs(x-istack)*2;
          else ps[i] = Math.abs(x-istack)*2+1;
        }
      
      	Arrays.sort(ps);
      	ans = 1;
      	for(int i = 0;i < n;i++){
          if(ps[i] == ans) ans++;
          else break;
    	}
      	if(ans%2 == 0) x -= ans/2;
      	else x += ans/2;
            
      	System.out.println(x);
      
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
      	int x = sc.nextInt();
        int n = sc.nextInt();
      	int ps[] = new int[n];
      	int ans;
      	int istack;
      
      	for(int i = 0;i < n;i++){
          istack = sc.nextInt();
          if(istack < x) ps[i] = Math.abs(x-istack)*2;
          else ps[i] = Math.abs(x-istack)*2+1;
        }
      
      	Arrays.sort(ps);
      	ans = 1;
      	for(int i = 0;i < n;i++){
          if(ps[i] == ans) ans++;
          else break;
    	}
      	if(ans%2 == 0) x -= ans/2;
      	else x += ans/2;
            
      	System.out.println(x);
      
	}
} 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 ps[] = new int[n];
      	int ans;
      	int istack;
      
      	for(int i = 0;i < n;i++){
          istack = sc.nextInt();
          if(istack < x) ps[i] = Math.abs(x-istack)*2;
          else ps[i] = Math.abs(x-istack)*2+1;
        }
      
      	Arrays.sort(ps);
      	ans = 1;
      	for(int i = 0;i < n;i++){
          if(ps[i] == ans) ans++;
          else break;
    	}
      	if(ans%2 == 0) x -= ans/2;
      	else x += ans/2;
            
      	System.out.println(x);
      
	}
}