import java.util.ArrayList;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sn = new Scanner(System.in);
        int x = Integer.parseInt(sn.next());
        int y = Integer.parseInt(sn.next());
        int[] list = new int[y];
        boolean flg = true;
        if ( y == 0){
            System.out.println(x);
            return;
        }else{
            for(int i =0; i < y ; i++ ){
                list[i] = Integer.parseInt(sn.next());
            }
        }
        for( int i = 0; i <= x ; i++ ){
            int d = x - i;
			for (int b =0; b < y ; b++ ){
                if (list[b] == d){
                    flg = false;
                } 
            }
            if (flg){
                System.out.println(d);
                return;
            }
            flg = true;
            int e = x + i;
			for (int c =0; c < y ; c++ ){
                if (list[c] == e){
                    flg = false;
                } 
            }
            if (flg){
                System.out.println(e);
                return;
            }
            flg = true;
        }
        
	}
}
 import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sn = new Scanner(System.in);
        int x = Integer.parseInt(sn.next());
        int y = Integer.parseInt(sn.next());
        int[] list = new int[y];
        boolean flg = true;
        if ( y == 0){
            System.out.println(x);
            return;
        }else{
            for(int i =0; i < y ; i++ ){
                list[i] = Integer.parseInt(sn.next());
            }
        }
        for( int i = 0; i <= x ; i++ ){
            int d = x - i;
			for (int b =0; b < y ; b++ ){
                if (list[b] == d){
                    flg = false;
                } 
            }
            if (flg){
                System.out.println(d);
                return;
            }
            flg = true;
            int e = x + i;
			for (int c =0; c < y ; c++ ){
                if (list[c] == e){
                    flg = false;
                } 
            }
            if (flg){
                System.out.println(e);
                return;
            }
            flg = true;
        }
        
	}
} Main public static void main(String[] args) {
		Scanner sn = new Scanner(System.in);
        int x = Integer.parseInt(sn.next());
        int y = Integer.parseInt(sn.next());
        int[] list = new int[y];
        boolean flg = true;
        if ( y == 0){
            System.out.println(x);
            return;
        }else{
            for(int i =0; i < y ; i++ ){
                list[i] = Integer.parseInt(sn.next());
            }
        }
        for( int i = 0; i <= x ; i++ ){
            int d = x - i;
			for (int b =0; b < y ; b++ ){
                if (list[b] == d){
                    flg = false;
                } 
            }
            if (flg){
                System.out.println(d);
                return;
            }
            flg = true;
            int e = x + i;
			for (int c =0; c < y ; c++ ){
                if (list[c] == e){
                    flg = false;
                } 
            }
            if (flg){
                System.out.println(e);
                return;
            }
            flg = true;
        }
        
	} main {
		Scanner sn = new Scanner(System.in);
        int x = Integer.parseInt(sn.next());
        int y = Integer.parseInt(sn.next());
        int[] list = new int[y];
        boolean flg = true;
        if ( y == 0){
            System.out.println(x);
            return;
        }else{
            for(int i =0; i < y ; i++ ){
                list[i] = Integer.parseInt(sn.next());
            }
        }
        for( int i = 0; i <= x ; i++ ){
            int d = x - i;
			for (int b =0; b < y ; b++ ){
                if (list[b] == d){
                    flg = false;
                } 
            }
            if (flg){
                System.out.println(d);
                return;
            }
            flg = true;
            int e = x + i;
			for (int c =0; c < y ; c++ ){
                if (list[c] == e){
                    flg = false;
                } 
            }
            if (flg){
                System.out.println(e);
                return;
            }
            flg = true;
        }
        
	} Scanner sn = new Scanner(System.in); sn new Scanner(System.in) int x = Integer.parseInt(sn.next()); x Integer.parseInt(sn.next()) Integer.parseInt Integer sn.next() sn.next sn int y = Integer.parseInt(sn.next()); y Integer.parseInt(sn.next()) Integer.parseInt Integer sn.next() sn.next sn int[] list = new int[y]; list new int[y] y boolean flg = true; flg true if ( y == 0){
            System.out.println(x);
            return;
        }else{
            for(int i =0; i < y ; i++ ){
                list[i] = Integer.parseInt(sn.next());
            }
        } y == 0 y 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 < y ; i++ ){
                list[i] = Integer.parseInt(sn.next());
            }
        } for(int i =0; i < y ; i++ ){
                list[i] = Integer.parseInt(sn.next());
            } int i =0; int i =0; i 0 i < y i y i++ i++ i {
                list[i] = Integer.parseInt(sn.next());
            } {
                list[i] = Integer.parseInt(sn.next());
            } list[i] = Integer.parseInt(sn.next()) list[i] list i Integer.parseInt(sn.next()) Integer.parseInt Integer sn.next() sn.next sn for( int i = 0; i <= x ; i++ ){
            int d = x - i;
			for (int b =0; b < y ; b++ ){
                if (list[b] == d){
                    flg = false;
                } 
            }
            if (flg){
                System.out.println(d);
                return;
            }
            flg = true;
            int e = x + i;
			for (int c =0; c < y ; c++ ){
                if (list[c] == e){
                    flg = false;
                } 
            }
            if (flg){
                System.out.println(e);
                return;
            }
            flg = true;
        } int i = 0; int i = 0; i 0 i <= x i x i++ i++ i {
            int d = x - i;
			for (int b =0; b < y ; b++ ){
                if (list[b] == d){
                    flg = false;
                } 
            }
            if (flg){
                System.out.println(d);
                return;
            }
            flg = true;
            int e = x + i;
			for (int c =0; c < y ; c++ ){
                if (list[c] == e){
                    flg = false;
                } 
            }
            if (flg){
                System.out.println(e);
                return;
            }
            flg = true;
        } {
            int d = x - i;
			for (int b =0; b < y ; b++ ){
                if (list[b] == d){
                    flg = false;
                } 
            }
            if (flg){
                System.out.println(d);
                return;
            }
            flg = true;
            int e = x + i;
			for (int c =0; c < y ; c++ ){
                if (list[c] == e){
                    flg = false;
                } 
            }
            if (flg){
                System.out.println(e);
                return;
            }
            flg = true;
        } int d = x - i; d x - i x i for (int b =0; b < y ; b++ ){
                if (list[b] == d){
                    flg = false;
                } 
            } int b =0; int b =0; b 0 b < y b y b++ b++ b {
                if (list[b] == d){
                    flg = false;
                } 
            } {
                if (list[b] == d){
                    flg = false;
                } 
            } if (list[b] == d){
                    flg = false;
                } list[b] == d list[b] list b d {
                    flg = false;
                } flg = false flg false if (flg){
                System.out.println(d);
                return;
            } flg {
                System.out.println(d);
                return;
            } System.out.println(d) System.out.println System.out System System.out d return; flg = true flg true int e = x + i; e x + i x i for (int c =0; c < y ; c++ ){
                if (list[c] == e){
                    flg = false;
                } 
            } int c =0; int c =0; c 0 c < y c y c++ c++ c {
                if (list[c] == e){
                    flg = false;
                } 
            } {
                if (list[c] == e){
                    flg = false;
                } 
            } if (list[c] == e){
                    flg = false;
                } list[c] == e list[c] list c e {
                    flg = false;
                } flg = false flg false if (flg){
                System.out.println(e);
                return;
            } flg {
                System.out.println(e);
                return;
            } System.out.println(e) System.out.println System.out System System.out e return; flg = true flg true String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sn = new Scanner(System.in);
        int x = Integer.parseInt(sn.next());
        int y = Integer.parseInt(sn.next());
        int[] list = new int[y];
        boolean flg = true;
        if ( y == 0){
            System.out.println(x);
            return;
        }else{
            for(int i =0; i < y ; i++ ){
                list[i] = Integer.parseInt(sn.next());
            }
        }
        for( int i = 0; i <= x ; i++ ){
            int d = x - i;
			for (int b =0; b < y ; b++ ){
                if (list[b] == d){
                    flg = false;
                } 
            }
            if (flg){
                System.out.println(d);
                return;
            }
            flg = true;
            int e = x + i;
			for (int c =0; c < y ; c++ ){
                if (list[c] == e){
                    flg = false;
                } 
            }
            if (flg){
                System.out.println(e);
                return;
            }
            flg = true;
        }
        
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sn = new Scanner(System.in);
        int x = Integer.parseInt(sn.next());
        int y = Integer.parseInt(sn.next());
        int[] list = new int[y];
        boolean flg = true;
        if ( y == 0){
            System.out.println(x);
            return;
        }else{
            for(int i =0; i < y ; i++ ){
                list[i] = Integer.parseInt(sn.next());
            }
        }
        for( int i = 0; i <= x ; i++ ){
            int d = x - i;
			for (int b =0; b < y ; b++ ){
                if (list[b] == d){
                    flg = false;
                } 
            }
            if (flg){
                System.out.println(d);
                return;
            }
            flg = true;
            int e = x + i;
			for (int c =0; c < y ; c++ ){
                if (list[c] == e){
                    flg = false;
                } 
            }
            if (flg){
                System.out.println(e);
                return;
            }
            flg = true;
        }
        
	}
} Main
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sn = new Scanner(System.in);
        int x = Integer.parseInt(sn.next());
        int y = Integer.parseInt(sn.next());
        int[] list = new int[y];
        boolean flg = true;
        if ( y == 0){
            System.out.println(x);
            return;
        }else{
            for(int i =0; i < y ; i++ ){
                list[i] = Integer.parseInt(sn.next());
            }
        }
        for( int i = 0; i <= x ; i++ ){
            int d = x - i;
			for (int b =0; b < y ; b++ ){
                if (list[b] == d){
                    flg = false;
                } 
            }
            if (flg){
                System.out.println(d);
                return;
            }
            flg = true;
            int e = x + i;
			for (int c =0; c < y ; c++ ){
                if (list[c] == e){
                    flg = false;
                } 
            }
            if (flg){
                System.out.println(e);
                return;
            }
            flg = true;
        }
        
	}
}

