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 res = 0;
        if(n == 0){
            System.out.println(x);
            System.exit(0);
        }

        List<Integer> array = new ArrayList<>();
        for(int i = 0; i < n; i++){
            array.add(sc.nextInt());
        }

        int A = x;
        int resA = 0;
        while(A > 0){
            if(!array.contains(A)){
                resA = A;
                break;
            }
            A--;
        }

        int B = x;
        int resB = 101;
        while(B <= 100){
            if(!array.contains(B)){
                resB = B;
                break;
            }
            B++;
        }

        if(Math.abs(resA) == Math.abs(resB)){
            if(resA > resB){
                res = resB;
            }else{
                res = resA;
            }
        }else if(Math.abs(x - resA) > Math.abs(x - resB)){
            res = resB;
        }else{
            res = resA;
        }
        System.out.println(res);
    }
} 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 res = 0;
        if(n == 0){
            System.out.println(x);
            System.exit(0);
        }

        List<Integer> array = new ArrayList<>();
        for(int i = 0; i < n; i++){
            array.add(sc.nextInt());
        }

        int A = x;
        int resA = 0;
        while(A > 0){
            if(!array.contains(A)){
                resA = A;
                break;
            }
            A--;
        }

        int B = x;
        int resB = 101;
        while(B <= 100){
            if(!array.contains(B)){
                resB = B;
                break;
            }
            B++;
        }

        if(Math.abs(resA) == Math.abs(resB)){
            if(resA > resB){
                res = resB;
            }else{
                res = resA;
            }
        }else if(Math.abs(x - resA) > Math.abs(x - resB)){
            res = resB;
        }else{
            res = resA;
        }
        System.out.println(res);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        int res = 0;
        if(n == 0){
            System.out.println(x);
            System.exit(0);
        }

        List<Integer> array = new ArrayList<>();
        for(int i = 0; i < n; i++){
            array.add(sc.nextInt());
        }

        int A = x;
        int resA = 0;
        while(A > 0){
            if(!array.contains(A)){
                resA = A;
                break;
            }
            A--;
        }

        int B = x;
        int resB = 101;
        while(B <= 100){
            if(!array.contains(B)){
                resB = B;
                break;
            }
            B++;
        }

        if(Math.abs(resA) == Math.abs(resB)){
            if(resA > resB){
                res = resB;
            }else{
                res = resA;
            }
        }else if(Math.abs(x - resA) > Math.abs(x - resB)){
            res = resB;
        }else{
            res = resA;
        }
        System.out.println(res);
    } main {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        int res = 0;
        if(n == 0){
            System.out.println(x);
            System.exit(0);
        }

        List<Integer> array = new ArrayList<>();
        for(int i = 0; i < n; i++){
            array.add(sc.nextInt());
        }

        int A = x;
        int resA = 0;
        while(A > 0){
            if(!array.contains(A)){
                resA = A;
                break;
            }
            A--;
        }

        int B = x;
        int resB = 101;
        while(B <= 100){
            if(!array.contains(B)){
                resB = B;
                break;
            }
            B++;
        }

        if(Math.abs(resA) == Math.abs(resB)){
            if(resA > resB){
                res = resB;
            }else{
                res = resA;
            }
        }else if(Math.abs(x - resA) > Math.abs(x - resB)){
            res = resB;
        }else{
            res = resA;
        }
        System.out.println(res);
    } 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 res = 0; res 0 if(n == 0){
            System.out.println(x);
            System.exit(0);
        } n == 0 n 0 {
            System.out.println(x);
            System.exit(0);
        } System.out.println(x) System.out.println System.out System System.out x System.exit(0) System.exit System 0 List<Integer> array = new ArrayList<>(); array new ArrayList<>() for(int i = 0; i < n; i++){
            array.add(sc.nextInt());
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            array.add(sc.nextInt());
        } {
            array.add(sc.nextInt());
        } array.add(sc.nextInt()) array.add array sc.nextInt() sc.nextInt sc int A = x; A x int resA = 0; resA 0 while(A > 0){
            if(!array.contains(A)){
                resA = A;
                break;
            }
            A--;
        } A > 0 A 0 {
            if(!array.contains(A)){
                resA = A;
                break;
            }
            A--;
        } if(!array.contains(A)){
                resA = A;
                break;
            } !array.contains(A) array.contains(A) array.contains array A {
                resA = A;
                break;
            } resA = A resA A break; A-- A int B = x; B x int resB = 101; resB 101 while(B <= 100){
            if(!array.contains(B)){
                resB = B;
                break;
            }
            B++;
        } B <= 100 B 100 {
            if(!array.contains(B)){
                resB = B;
                break;
            }
            B++;
        } if(!array.contains(B)){
                resB = B;
                break;
            } !array.contains(B) array.contains(B) array.contains array B {
                resB = B;
                break;
            } resB = B resB B break; B++ B if(Math.abs(resA) == Math.abs(resB)){
            if(resA > resB){
                res = resB;
            }else{
                res = resA;
            }
        }else if(Math.abs(x - resA) > Math.abs(x - resB)){
            res = resB;
        }else{
            res = resA;
        } Math.abs(resA) == Math.abs(resB) Math.abs(resA) Math.abs Math resA Math.abs(resB) Math.abs Math resB {
            if(resA > resB){
                res = resB;
            }else{
                res = resA;
            }
        } if(resA > resB){
                res = resB;
            }else{
                res = resA;
            } resA > resB resA resB {
                res = resB;
            } res = resB res resB {
                res = resA;
            } res = resA res resA if(Math.abs(x - resA) > Math.abs(x - resB)){
            res = resB;
        }else{
            res = resA;
        } Math.abs(x - resA) > Math.abs(x - resB) Math.abs(x - resA) Math.abs Math x - resA x resA Math.abs(x - resB) Math.abs Math x - resB x resB {
            res = resB;
        } res = resB res resB {
            res = resA;
        } res = resA res resA System.out.println(res) System.out.println System.out System System.out res 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 res = 0;
        if(n == 0){
            System.out.println(x);
            System.exit(0);
        }

        List<Integer> array = new ArrayList<>();
        for(int i = 0; i < n; i++){
            array.add(sc.nextInt());
        }

        int A = x;
        int resA = 0;
        while(A > 0){
            if(!array.contains(A)){
                resA = A;
                break;
            }
            A--;
        }

        int B = x;
        int resB = 101;
        while(B <= 100){
            if(!array.contains(B)){
                resB = B;
                break;
            }
            B++;
        }

        if(Math.abs(resA) == Math.abs(resB)){
            if(resA > resB){
                res = resB;
            }else{
                res = resA;
            }
        }else if(Math.abs(x - resA) > Math.abs(x - resB)){
            res = resB;
        }else{
            res = resA;
        }
        System.out.println(res);
    }
} public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        int res = 0;
        if(n == 0){
            System.out.println(x);
            System.exit(0);
        }

        List<Integer> array = new ArrayList<>();
        for(int i = 0; i < n; i++){
            array.add(sc.nextInt());
        }

        int A = x;
        int resA = 0;
        while(A > 0){
            if(!array.contains(A)){
                resA = A;
                break;
            }
            A--;
        }

        int B = x;
        int resB = 101;
        while(B <= 100){
            if(!array.contains(B)){
                resB = B;
                break;
            }
            B++;
        }

        if(Math.abs(resA) == Math.abs(resB)){
            if(resA > resB){
                res = resB;
            }else{
                res = resA;
            }
        }else if(Math.abs(x - resA) > Math.abs(x - resB)){
            res = resB;
        }else{
            res = resA;
        }
        System.out.println(res);
    }
} 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 res = 0;
        if(n == 0){
            System.out.println(x);
            System.exit(0);
        }

        List<Integer> array = new ArrayList<>();
        for(int i = 0; i < n; i++){
            array.add(sc.nextInt());
        }

        int A = x;
        int resA = 0;
        while(A > 0){
            if(!array.contains(A)){
                resA = A;
                break;
            }
            A--;
        }

        int B = x;
        int resB = 101;
        while(B <= 100){
            if(!array.contains(B)){
                resB = B;
                break;
            }
            B++;
        }

        if(Math.abs(resA) == Math.abs(resB)){
            if(resA > resB){
                res = resB;
            }else{
                res = resA;
            }
        }else if(Math.abs(x - resA) > Math.abs(x - resB)){
            res = resB;
        }else{
            res = resA;
        }
        System.out.println(res);
    }
}
