import java.util.Scanner;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;

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();
        List<Integer> list = new ArrayList<>();
        if(n != 0){
            for(int i = 0; i < n; i++){
            int a = sc.nextInt();
            list.add(a);
            }
            sc.close();
            int i = 0;
            int ans;
            while(true){
                int a = x - i;
                int b = x + i;
                if(!list.contains(a)){
                    ans = a;
                    break;
                }else if(!list.contains(b)){
                    ans = b;
                    break;
                }
                i++;
            }
            System.out.print(ans);
        }else{
            System.out.println(x);
        }
    }
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util import java.util.List; List java.util import java.util.ArrayList; ArrayList 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();
        List<Integer> list = new ArrayList<>();
        if(n != 0){
            for(int i = 0; i < n; i++){
            int a = sc.nextInt();
            list.add(a);
            }
            sc.close();
            int i = 0;
            int ans;
            while(true){
                int a = x - i;
                int b = x + i;
                if(!list.contains(a)){
                    ans = a;
                    break;
                }else if(!list.contains(b)){
                    ans = b;
                    break;
                }
                i++;
            }
            System.out.print(ans);
        }else{
            System.out.println(x);
        }
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        List<Integer> list = new ArrayList<>();
        if(n != 0){
            for(int i = 0; i < n; i++){
            int a = sc.nextInt();
            list.add(a);
            }
            sc.close();
            int i = 0;
            int ans;
            while(true){
                int a = x - i;
                int b = x + i;
                if(!list.contains(a)){
                    ans = a;
                    break;
                }else if(!list.contains(b)){
                    ans = b;
                    break;
                }
                i++;
            }
            System.out.print(ans);
        }else{
            System.out.println(x);
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        List<Integer> list = new ArrayList<>();
        if(n != 0){
            for(int i = 0; i < n; i++){
            int a = sc.nextInt();
            list.add(a);
            }
            sc.close();
            int i = 0;
            int ans;
            while(true){
                int a = x - i;
                int b = x + i;
                if(!list.contains(a)){
                    ans = a;
                    break;
                }else if(!list.contains(b)){
                    ans = b;
                    break;
                }
                i++;
            }
            System.out.print(ans);
        }else{
            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 List<Integer> list = new ArrayList<>(); list new ArrayList<>() if(n != 0){
            for(int i = 0; i < n; i++){
            int a = sc.nextInt();
            list.add(a);
            }
            sc.close();
            int i = 0;
            int ans;
            while(true){
                int a = x - i;
                int b = x + i;
                if(!list.contains(a)){
                    ans = a;
                    break;
                }else if(!list.contains(b)){
                    ans = b;
                    break;
                }
                i++;
            }
            System.out.print(ans);
        }else{
            System.out.println(x);
        } n != 0 n 0 {
            for(int i = 0; i < n; i++){
            int a = sc.nextInt();
            list.add(a);
            }
            sc.close();
            int i = 0;
            int ans;
            while(true){
                int a = x - i;
                int b = x + i;
                if(!list.contains(a)){
                    ans = a;
                    break;
                }else if(!list.contains(b)){
                    ans = b;
                    break;
                }
                i++;
            }
            System.out.print(ans);
        } for(int i = 0; i < n; i++){
            int a = sc.nextInt();
            list.add(a);
            } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            int a = sc.nextInt();
            list.add(a);
            } {
            int a = sc.nextInt();
            list.add(a);
            } int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc list.add(a) list.add list a sc.close() sc.close sc int i = 0; i 0 int ans; ans while(true){
                int a = x - i;
                int b = x + i;
                if(!list.contains(a)){
                    ans = a;
                    break;
                }else if(!list.contains(b)){
                    ans = b;
                    break;
                }
                i++;
            } true {
                int a = x - i;
                int b = x + i;
                if(!list.contains(a)){
                    ans = a;
                    break;
                }else if(!list.contains(b)){
                    ans = b;
                    break;
                }
                i++;
            } int a = x - i; a x - i x i int b = x + i; b x + i x i if(!list.contains(a)){
                    ans = a;
                    break;
                }else if(!list.contains(b)){
                    ans = b;
                    break;
                } !list.contains(a) list.contains(a) list.contains list a {
                    ans = a;
                    break;
                } ans = a ans a break; if(!list.contains(b)){
                    ans = b;
                    break;
                } !list.contains(b) list.contains(b) list.contains list b {
                    ans = b;
                    break;
                } ans = b ans b break; i++ i System.out.print(ans) System.out.print System.out System System.out ans {
            System.out.println(x);
        } 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) throws Exception {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        List<Integer> list = new ArrayList<>();
        if(n != 0){
            for(int i = 0; i < n; i++){
            int a = sc.nextInt();
            list.add(a);
            }
            sc.close();
            int i = 0;
            int ans;
            while(true){
                int a = x - i;
                int b = x + i;
                if(!list.contains(a)){
                    ans = a;
                    break;
                }else if(!list.contains(b)){
                    ans = b;
                    break;
                }
                i++;
            }
            System.out.print(ans);
        }else{
            System.out.println(x);
        }
    }
} 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();
        List<Integer> list = new ArrayList<>();
        if(n != 0){
            for(int i = 0; i < n; i++){
            int a = sc.nextInt();
            list.add(a);
            }
            sc.close();
            int i = 0;
            int ans;
            while(true){
                int a = x - i;
                int b = x + i;
                if(!list.contains(a)){
                    ans = a;
                    break;
                }else if(!list.contains(b)){
                    ans = b;
                    break;
                }
                i++;
            }
            System.out.print(ans);
        }else{
            System.out.println(x);
        }
    }
} Main
import java.util.Scanner;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;

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();
        List<Integer> list = new ArrayList<>();
        if(n != 0){
            for(int i = 0; i < n; i++){
            int a = sc.nextInt();
            list.add(a);
            }
            sc.close();
            int i = 0;
            int ans;
            while(true){
                int a = x - i;
                int b = x + i;
                if(!list.contains(a)){
                    ans = a;
                    break;
                }else if(!list.contains(b)){
                    ans = b;
                    break;
                }
                i++;
            }
            System.out.print(ans);
        }else{
            System.out.println(x);
        }
    }
}
