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();

        if(n == 0) {
            System.out.println(x);
            System.exit(0);
        }

        int[] p = new int[n];

        for(int i=0; i<n; i++) {
            p[i] = sc.nextInt();
        }

        ArrayList<Integer> ep = new ArrayList<>();
        for(int i=0; i<=101; i++) {
            boolean isFound = false;
            for(int j=0; j<p.length; j++) {
                if(i == p[j]) isFound = true;
            }
            if(!isFound) ep.add(i);
        }

        int diff = 0;
        int comp = 0;
        int ans = 0;
        for(int i=0; i<ep.size(); i++) {
            diff = Math.abs(x-ep.get(i));
            if(i == 0) comp = diff;
            if(comp > diff) {
                comp = diff;
                ans = ep.get(i);
            }
        }
        System.out.println(ans);
    }
} 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();

        if(n == 0) {
            System.out.println(x);
            System.exit(0);
        }

        int[] p = new int[n];

        for(int i=0; i<n; i++) {
            p[i] = sc.nextInt();
        }

        ArrayList<Integer> ep = new ArrayList<>();
        for(int i=0; i<=101; i++) {
            boolean isFound = false;
            for(int j=0; j<p.length; j++) {
                if(i == p[j]) isFound = true;
            }
            if(!isFound) ep.add(i);
        }

        int diff = 0;
        int comp = 0;
        int ans = 0;
        for(int i=0; i<ep.size(); i++) {
            diff = Math.abs(x-ep.get(i));
            if(i == 0) comp = diff;
            if(comp > diff) {
                comp = diff;
                ans = ep.get(i);
            }
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int x = sc.nextInt();
        int n = sc.nextInt();

        if(n == 0) {
            System.out.println(x);
            System.exit(0);
        }

        int[] p = new int[n];

        for(int i=0; i<n; i++) {
            p[i] = sc.nextInt();
        }

        ArrayList<Integer> ep = new ArrayList<>();
        for(int i=0; i<=101; i++) {
            boolean isFound = false;
            for(int j=0; j<p.length; j++) {
                if(i == p[j]) isFound = true;
            }
            if(!isFound) ep.add(i);
        }

        int diff = 0;
        int comp = 0;
        int ans = 0;
        for(int i=0; i<ep.size(); i++) {
            diff = Math.abs(x-ep.get(i));
            if(i == 0) comp = diff;
            if(comp > diff) {
                comp = diff;
                ans = ep.get(i);
            }
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);

        int x = sc.nextInt();
        int n = sc.nextInt();

        if(n == 0) {
            System.out.println(x);
            System.exit(0);
        }

        int[] p = new int[n];

        for(int i=0; i<n; i++) {
            p[i] = sc.nextInt();
        }

        ArrayList<Integer> ep = new ArrayList<>();
        for(int i=0; i<=101; i++) {
            boolean isFound = false;
            for(int j=0; j<p.length; j++) {
                if(i == p[j]) isFound = true;
            }
            if(!isFound) ep.add(i);
        }

        int diff = 0;
        int comp = 0;
        int ans = 0;
        for(int i=0; i<ep.size(); i++) {
            diff = Math.abs(x-ep.get(i));
            if(i == 0) comp = diff;
            if(comp > diff) {
                comp = diff;
                ans = ep.get(i);
            }
        }
        System.out.println(ans);
    } 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 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 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 ArrayList<Integer> ep = new ArrayList<>(); ep new ArrayList<>() for(int i=0; i<=101; i++) {
            boolean isFound = false;
            for(int j=0; j<p.length; j++) {
                if(i == p[j]) isFound = true;
            }
            if(!isFound) ep.add(i);
        } int i=0; int i=0; i 0 i<=101 i 101 i++ i++ i {
            boolean isFound = false;
            for(int j=0; j<p.length; j++) {
                if(i == p[j]) isFound = true;
            }
            if(!isFound) ep.add(i);
        } {
            boolean isFound = false;
            for(int j=0; j<p.length; j++) {
                if(i == p[j]) isFound = true;
            }
            if(!isFound) ep.add(i);
        } boolean isFound = false; isFound false for(int j=0; j<p.length; j++) {
                if(i == p[j]) isFound = true;
            } int j=0; int j=0; j 0 j<p.length j p.length p p.length j++ j++ j {
                if(i == p[j]) isFound = true;
            } {
                if(i == p[j]) isFound = true;
            } if(i == p[j]) isFound = true; i == p[j] i p[j] p j isFound = true isFound true if(!isFound) ep.add(i); !isFound isFound ep.add(i) ep.add ep i int diff = 0; diff 0 int comp = 0; comp 0 int ans = 0; ans 0 for(int i=0; i<ep.size(); i++) {
            diff = Math.abs(x-ep.get(i));
            if(i == 0) comp = diff;
            if(comp > diff) {
                comp = diff;
                ans = ep.get(i);
            }
        } int i=0; int i=0; i 0 i<ep.size() i ep.size() ep.size ep i++ i++ i {
            diff = Math.abs(x-ep.get(i));
            if(i == 0) comp = diff;
            if(comp > diff) {
                comp = diff;
                ans = ep.get(i);
            }
        } {
            diff = Math.abs(x-ep.get(i));
            if(i == 0) comp = diff;
            if(comp > diff) {
                comp = diff;
                ans = ep.get(i);
            }
        } diff = Math.abs(x-ep.get(i)) diff Math.abs(x-ep.get(i)) Math.abs Math x-ep.get(i) x ep.get(i) ep.get ep i if(i == 0) comp = diff; i == 0 i 0 comp = diff comp diff if(comp > diff) {
                comp = diff;
                ans = ep.get(i);
            } comp > diff comp diff {
                comp = diff;
                ans = ep.get(i);
            } comp = diff comp diff ans = ep.get(i) ans ep.get(i) ep.get ep i System.out.println(ans) System.out.println System.out System System.out ans 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();

        if(n == 0) {
            System.out.println(x);
            System.exit(0);
        }

        int[] p = new int[n];

        for(int i=0; i<n; i++) {
            p[i] = sc.nextInt();
        }

        ArrayList<Integer> ep = new ArrayList<>();
        for(int i=0; i<=101; i++) {
            boolean isFound = false;
            for(int j=0; j<p.length; j++) {
                if(i == p[j]) isFound = true;
            }
            if(!isFound) ep.add(i);
        }

        int diff = 0;
        int comp = 0;
        int ans = 0;
        for(int i=0; i<ep.size(); i++) {
            diff = Math.abs(x-ep.get(i));
            if(i == 0) comp = diff;
            if(comp > diff) {
                comp = diff;
                ans = ep.get(i);
            }
        }
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int x = sc.nextInt();
        int n = sc.nextInt();

        if(n == 0) {
            System.out.println(x);
            System.exit(0);
        }

        int[] p = new int[n];

        for(int i=0; i<n; i++) {
            p[i] = sc.nextInt();
        }

        ArrayList<Integer> ep = new ArrayList<>();
        for(int i=0; i<=101; i++) {
            boolean isFound = false;
            for(int j=0; j<p.length; j++) {
                if(i == p[j]) isFound = true;
            }
            if(!isFound) ep.add(i);
        }

        int diff = 0;
        int comp = 0;
        int ans = 0;
        for(int i=0; i<ep.size(); i++) {
            diff = Math.abs(x-ep.get(i));
            if(i == 0) comp = diff;
            if(comp > diff) {
                comp = diff;
                ans = ep.get(i);
            }
        }
        System.out.println(ans);
    }
} 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();

        if(n == 0) {
            System.out.println(x);
            System.exit(0);
        }

        int[] p = new int[n];

        for(int i=0; i<n; i++) {
            p[i] = sc.nextInt();
        }

        ArrayList<Integer> ep = new ArrayList<>();
        for(int i=0; i<=101; i++) {
            boolean isFound = false;
            for(int j=0; j<p.length; j++) {
                if(i == p[j]) isFound = true;
            }
            if(!isFound) ep.add(i);
        }

        int diff = 0;
        int comp = 0;
        int ans = 0;
        for(int i=0; i<ep.size(); i++) {
            diff = Math.abs(x-ep.get(i));
            if(i == 0) comp = diff;
            if(comp > diff) {
                comp = diff;
                ans = ep.get(i);
            }
        }
        System.out.println(ans);
    }
}
