import javax.swing.plaf.metal.MetalInternalFrameTitlePane;
import java.math.BigInteger;
import java.util.*;
import java.io.*;
import java.text.*;

public class Main {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 32768);
    static PrintWriter out = new PrintWriter(System.out);
    static StringTokenizer t;

    static String sn() {
        while (t == null || !t.hasMoreTokens()) {
            try {
                t = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            }
        }
        return t.nextToken();
    }

    static int ni() {
        return Integer.parseInt(sn());
    }

    static long nlo() {
        return Long.parseLong(sn());
    }

    static long mod = (long) 1000000007;

    static long pro(long a, long b) {
        return (a % mod * b % mod) % mod;
    }

    static long add(long a, long b) {
        return (a + b) % mod;
    }

    static long sub(long a, long b) {
        return ((a % mod - b % mod) + mod) % mod;
    }

    static int pow(int n) {
        return (int) (Math.log10(n) / Math.log10(2));
    }

    static int modpow(int x, int y) {
        int res = 1;
//        x %= mod;
        while (y > 0) {
            if (y % 2 != 0)
                res *= x;
            x = x * x;
            y /= 2;
        }
        return res;
    }

//    static class pair {
//        String a;
//        int b;
//
//        pair(String x, int y) {
//            a = x;
//            b = y;
//        }
//    }

    static long modInverse(long n) {
        BigInteger n1 = new BigInteger(Long.toString(n));
        String s = (n1.modInverse(new BigInteger(Long.toString(mod)))).toString();
        return Long.parseLong(s) % mod;
    }

    static boolean v[] = new boolean[1000005];

    static void seive() {
        v[1] = true;
        for (int i = 2; i < 1000005; i++) {
            if (!v[i]) {
                for (int j = 2 * i; j < 1000005; j += i)
                    v[j] = true;
            }
        }
    }

    static boolean isprime(long n) {
        if (n == 1)
            return false;
        for (int i = 2; i * i <= n; i++) {
            if (n % i == 0)
                return false;
        }
        return true;
    }

    static int gcd(int a, int b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    static DecimalFormat df = new DecimalFormat("0.000000000000000000000");

    static class trie {
        trie a[] = new trie[26];
        int cnt = 0;
    }

    static int maxn = (int) 3e5 + 5;

    static long gcd(long a, long b) {
        if (b == 0)
            return a;
        else
            return gcd(b, a % b);
    }

    static void solve() {
        int x = ni();
        int n = ni();
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            map.put(ni(), 1);
        }
        if (n == 0)
            out.println(x);
        else {
            int ans = -1;
            for (int i = x; i <= 1000; i++) {
                if (!map.containsKey(i)) {
                    ans = i;
                    break;
                }
            }
            for (int i = x - 1; i >= -1000; i--) {
                if (!map.containsKey(i)) {
                    int d1=Math.abs(x - i);
                    int d2=Math.abs(x - ans);
                    if (d1<d2 || (d1==d2 && i<ans)) {
                        ans = i;
                        break;
                    }
                }
            }
            out.println(ans);
        }
    }

    public static void main(String args[]) {
        int t = 1;
        while (t-- > 0) {
            solve();
        }
        out.close();
    }
}
 import javax.swing.plaf.metal.MetalInternalFrameTitlePane; MetalInternalFrameTitlePane javax.swing.plaf.metal import java.math.BigInteger; BigInteger java.math import java.util.*; util.* java import java.io.*; io.* java import java.text.*; text.* java public class Main {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 32768);
    static PrintWriter out = new PrintWriter(System.out);
    static StringTokenizer t;

    static String sn() {
        while (t == null || !t.hasMoreTokens()) {
            try {
                t = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            }
        }
        return t.nextToken();
    }

    static int ni() {
        return Integer.parseInt(sn());
    }

    static long nlo() {
        return Long.parseLong(sn());
    }

    static long mod = (long) 1000000007;

    static long pro(long a, long b) {
        return (a % mod * b % mod) % mod;
    }

    static long add(long a, long b) {
        return (a + b) % mod;
    }

    static long sub(long a, long b) {
        return ((a % mod - b % mod) + mod) % mod;
    }

    static int pow(int n) {
        return (int) (Math.log10(n) / Math.log10(2));
    }

    static int modpow(int x, int y) {
        int res = 1;
//        x %= mod;
        while (y > 0) {
            if (y % 2 != 0)
                res *= x;
            x = x * x;
            y /= 2;
        }
        return res;
    }

//    static class pair {
//        String a;
//        int b;
//
//        pair(String x, int y) {
//            a = x;
//            b = y;
//        }
//    }

    static long modInverse(long n) {
        BigInteger n1 = new BigInteger(Long.toString(n));
        String s = (n1.modInverse(new BigInteger(Long.toString(mod)))).toString();
        return Long.parseLong(s) % mod;
    }

    static boolean v[] = new boolean[1000005];

    static void seive() {
        v[1] = true;
        for (int i = 2; i < 1000005; i++) {
            if (!v[i]) {
                for (int j = 2 * i; j < 1000005; j += i)
                    v[j] = true;
            }
        }
    }

    static boolean isprime(long n) {
        if (n == 1)
            return false;
        for (int i = 2; i * i <= n; i++) {
            if (n % i == 0)
                return false;
        }
        return true;
    }

    static int gcd(int a, int b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    static DecimalFormat df = new DecimalFormat("0.000000000000000000000");

    static class trie {
        trie a[] = new trie[26];
        int cnt = 0;
    }

    static int maxn = (int) 3e5 + 5;

    static long gcd(long a, long b) {
        if (b == 0)
            return a;
        else
            return gcd(b, a % b);
    }

    static void solve() {
        int x = ni();
        int n = ni();
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            map.put(ni(), 1);
        }
        if (n == 0)
            out.println(x);
        else {
            int ans = -1;
            for (int i = x; i <= 1000; i++) {
                if (!map.containsKey(i)) {
                    ans = i;
                    break;
                }
            }
            for (int i = x - 1; i >= -1000; i--) {
                if (!map.containsKey(i)) {
                    int d1=Math.abs(x - i);
                    int d2=Math.abs(x - ans);
                    if (d1<d2 || (d1==d2 && i<ans)) {
                        ans = i;
                        break;
                    }
                }
            }
            out.println(ans);
        }
    }

    public static void main(String args[]) {
        int t = 1;
        while (t-- > 0) {
            solve();
        }
        out.close();
    }
} Main static BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 32768); br new BufferedReader(new InputStreamReader(System.in), 32768) static PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) static StringTokenizer t; t static long mod = (long) 1000000007; mod (long) 1000000007 static boolean v[] = new boolean[1000005]; v new boolean[1000005] 1000005 static DecimalFormat df = new DecimalFormat("0.000000000000000000000"); df new DecimalFormat("0.000000000000000000000") static int maxn = (int) 3e5 + 5; maxn (int) 3e5 + 5 (int) 3e5 5 static String sn() {
        while (t == null || !t.hasMoreTokens()) {
            try {
                t = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            }
        }
        return t.nextToken();
    } sn {
        while (t == null || !t.hasMoreTokens()) {
            try {
                t = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            }
        }
        return t.nextToken();
    } while (t == null || !t.hasMoreTokens()) {
            try {
                t = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            }
        } t == null || !t.hasMoreTokens() t == null t null !t.hasMoreTokens() t.hasMoreTokens() t.hasMoreTokens t {
            try {
                t = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            }
        } try {
                t = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            } catch (IOException e) {
                throw new RuntimeException();
            } IOException e {
                throw new RuntimeException();
            } throw new RuntimeException(); new RuntimeException() {
                t = new StringTokenizer(br.readLine());
            } t = new StringTokenizer(br.readLine()) t new StringTokenizer(br.readLine()) return t.nextToken(); t.nextToken() t.nextToken t static int ni() {
        return Integer.parseInt(sn());
    } ni {
        return Integer.parseInt(sn());
    } return Integer.parseInt(sn()); Integer.parseInt(sn()) Integer.parseInt Integer sn() sn static long nlo() {
        return Long.parseLong(sn());
    } nlo {
        return Long.parseLong(sn());
    } return Long.parseLong(sn()); Long.parseLong(sn()) Long.parseLong Long sn() sn static long pro(long a, long b) {
        return (a % mod * b % mod) % mod;
    } pro {
        return (a % mod * b % mod) % mod;
    } return (a % mod * b % mod) % mod; (a % mod * b % mod) % mod (a % mod * b % mod) a % mod * b a % mod a mod b mod mod long a a long b b static long add(long a, long b) {
        return (a + b) % mod;
    } add {
        return (a + b) % mod;
    } return (a + b) % mod; (a + b) % mod (a + b) a b mod long a a long b b static long sub(long a, long b) {
        return ((a % mod - b % mod) + mod) % mod;
    } sub {
        return ((a % mod - b % mod) + mod) % mod;
    } return ((a % mod - b % mod) + mod) % mod; ((a % mod - b % mod) + mod) % mod ((a % mod - b % mod) + mod) (a % mod - b % mod) a % mod a mod b % mod b mod mod mod long a a long b b static int pow(int n) {
        return (int) (Math.log10(n) / Math.log10(2));
    } pow {
        return (int) (Math.log10(n) / Math.log10(2));
    } return (int) (Math.log10(n) / Math.log10(2)); (int) (Math.log10(n) / Math.log10(2)) Math.log10(n) Math.log10 Math n Math.log10(2) Math.log10 Math 2 int n n static int modpow(int x, int y) {
        int res = 1;
//        x %= mod;
        while (y > 0) {
            if (y % 2 != 0)
                res *= x;
            x = x * x;
            y /= 2;
        }
        return res;
    } modpow {
        int res = 1;
//        x %= mod;
        while (y > 0) {
            if (y % 2 != 0)
                res *= x;
            x = x * x;
            y /= 2;
        }
        return res;
    } int res = 1; res 1 while (y > 0) {
            if (y % 2 != 0)
                res *= x;
            x = x * x;
            y /= 2;
        } y > 0 y 0 {
            if (y % 2 != 0)
                res *= x;
            x = x * x;
            y /= 2;
        } if (y % 2 != 0)
                res *= x; y % 2 != 0 y % 2 y 2 0 res *= x res x x = x * x x x * x x x y /= 2 y 2 return res; res int x x int y y static long modInverse(long n) {
        BigInteger n1 = new BigInteger(Long.toString(n));
        String s = (n1.modInverse(new BigInteger(Long.toString(mod)))).toString();
        return Long.parseLong(s) % mod;
    } modInverse {
        BigInteger n1 = new BigInteger(Long.toString(n));
        String s = (n1.modInverse(new BigInteger(Long.toString(mod)))).toString();
        return Long.parseLong(s) % mod;
    } BigInteger n1 = new BigInteger(Long.toString(n)); n1 new BigInteger(Long.toString(n)) String s = (n1.modInverse(new BigInteger(Long.toString(mod)))).toString(); s (n1.modInverse(new BigInteger(Long.toString(mod)))).toString() (n1.modInverse(new BigInteger(Long.toString(mod)))).toString (n1.modInverse(new BigInteger(Long.toString(mod)))) n1.modInverse n1 new BigInteger(Long.toString(mod)) return Long.parseLong(s) % mod; Long.parseLong(s) % mod Long.parseLong(s) Long.parseLong Long s mod long n n static void seive() {
        v[1] = true;
        for (int i = 2; i < 1000005; i++) {
            if (!v[i]) {
                for (int j = 2 * i; j < 1000005; j += i)
                    v[j] = true;
            }
        }
    } seive {
        v[1] = true;
        for (int i = 2; i < 1000005; i++) {
            if (!v[i]) {
                for (int j = 2 * i; j < 1000005; j += i)
                    v[j] = true;
            }
        }
    } v[1] = true v[1] v 1 true for (int i = 2; i < 1000005; i++) {
            if (!v[i]) {
                for (int j = 2 * i; j < 1000005; j += i)
                    v[j] = true;
            }
        } int i = 2; int i = 2; i 2 i < 1000005 i 1000005 i++ i++ i {
            if (!v[i]) {
                for (int j = 2 * i; j < 1000005; j += i)
                    v[j] = true;
            }
        } {
            if (!v[i]) {
                for (int j = 2 * i; j < 1000005; j += i)
                    v[j] = true;
            }
        } if (!v[i]) {
                for (int j = 2 * i; j < 1000005; j += i)
                    v[j] = true;
            } !v[i] v[i] v i {
                for (int j = 2 * i; j < 1000005; j += i)
                    v[j] = true;
            } for (int j = 2 * i; j < 1000005; j += i)
                    v[j] = true; int j = 2 * i; int j = 2 * i; j 2 * i 2 i j < 1000005 j 1000005 j += i j += i j i v[j] = true; v[j] = true v[j] v j true static boolean isprime(long n) {
        if (n == 1)
            return false;
        for (int i = 2; i * i <= n; i++) {
            if (n % i == 0)
                return false;
        }
        return true;
    } isprime {
        if (n == 1)
            return false;
        for (int i = 2; i * i <= n; i++) {
            if (n % i == 0)
                return false;
        }
        return true;
    } if (n == 1)
            return false; n == 1 n 1 return false; false for (int i = 2; i * i <= n; i++) {
            if (n % i == 0)
                return false;
        } int i = 2; int i = 2; i 2 i * i <= n i * i i i n i++ i++ i {
            if (n % i == 0)
                return false;
        } {
            if (n % i == 0)
                return false;
        } if (n % i == 0)
                return false; n % i == 0 n % i n i 0 return false; false return true; true long n n static int gcd(int a, int b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    } gcd {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    } if (b == 0)
            return a; b == 0 b 0 return a; a return gcd(b, a % b); gcd(b, a % b) gcd b a % b a b int a a int b b static long gcd(long a, long b) {
        if (b == 0)
            return a;
        else
            return gcd(b, a % b);
    } gcd {
        if (b == 0)
            return a;
        else
            return gcd(b, a % b);
    } if (b == 0)
            return a;
        else
            return gcd(b, a % b); b == 0 b 0 return a; a return gcd(b, a % b); gcd(b, a % b) gcd b a % b a b long a a long b b static void solve() {
        int x = ni();
        int n = ni();
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            map.put(ni(), 1);
        }
        if (n == 0)
            out.println(x);
        else {
            int ans = -1;
            for (int i = x; i <= 1000; i++) {
                if (!map.containsKey(i)) {
                    ans = i;
                    break;
                }
            }
            for (int i = x - 1; i >= -1000; i--) {
                if (!map.containsKey(i)) {
                    int d1=Math.abs(x - i);
                    int d2=Math.abs(x - ans);
                    if (d1<d2 || (d1==d2 && i<ans)) {
                        ans = i;
                        break;
                    }
                }
            }
            out.println(ans);
        }
    } solve {
        int x = ni();
        int n = ni();
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            map.put(ni(), 1);
        }
        if (n == 0)
            out.println(x);
        else {
            int ans = -1;
            for (int i = x; i <= 1000; i++) {
                if (!map.containsKey(i)) {
                    ans = i;
                    break;
                }
            }
            for (int i = x - 1; i >= -1000; i--) {
                if (!map.containsKey(i)) {
                    int d1=Math.abs(x - i);
                    int d2=Math.abs(x - ans);
                    if (d1<d2 || (d1==d2 && i<ans)) {
                        ans = i;
                        break;
                    }
                }
            }
            out.println(ans);
        }
    } int x = ni(); x ni() ni int n = ni(); n ni() ni HashMap<Integer, Integer> map = new HashMap<>(); map new HashMap<>() for (int i = 0; i < n; i++) {
            map.put(ni(), 1);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            map.put(ni(), 1);
        } {
            map.put(ni(), 1);
        } map.put(ni(), 1) map.put map ni() ni 1 if (n == 0)
            out.println(x);
        else {
            int ans = -1;
            for (int i = x; i <= 1000; i++) {
                if (!map.containsKey(i)) {
                    ans = i;
                    break;
                }
            }
            for (int i = x - 1; i >= -1000; i--) {
                if (!map.containsKey(i)) {
                    int d1=Math.abs(x - i);
                    int d2=Math.abs(x - ans);
                    if (d1<d2 || (d1==d2 && i<ans)) {
                        ans = i;
                        break;
                    }
                }
            }
            out.println(ans);
        } n == 0 n 0 out.println(x) out.println out x {
            int ans = -1;
            for (int i = x; i <= 1000; i++) {
                if (!map.containsKey(i)) {
                    ans = i;
                    break;
                }
            }
            for (int i = x - 1; i >= -1000; i--) {
                if (!map.containsKey(i)) {
                    int d1=Math.abs(x - i);
                    int d2=Math.abs(x - ans);
                    if (d1<d2 || (d1==d2 && i<ans)) {
                        ans = i;
                        break;
                    }
                }
            }
            out.println(ans);
        } int ans = -1; ans -1 1 for (int i = x; i <= 1000; i++) {
                if (!map.containsKey(i)) {
                    ans = i;
                    break;
                }
            } int i = x; int i = x; i x i <= 1000 i 1000 i++ i++ i {
                if (!map.containsKey(i)) {
                    ans = i;
                    break;
                }
            } {
                if (!map.containsKey(i)) {
                    ans = i;
                    break;
                }
            } if (!map.containsKey(i)) {
                    ans = i;
                    break;
                } !map.containsKey(i) map.containsKey(i) map.containsKey map i {
                    ans = i;
                    break;
                } ans = i ans i break; for (int i = x - 1; i >= -1000; i--) {
                if (!map.containsKey(i)) {
                    int d1=Math.abs(x - i);
                    int d2=Math.abs(x - ans);
                    if (d1<d2 || (d1==d2 && i<ans)) {
                        ans = i;
                        break;
                    }
                }
            } int i = x - 1; int i = x - 1; i x - 1 x 1 i >= -1000 i -1000 1000 i-- i-- i {
                if (!map.containsKey(i)) {
                    int d1=Math.abs(x - i);
                    int d2=Math.abs(x - ans);
                    if (d1<d2 || (d1==d2 && i<ans)) {
                        ans = i;
                        break;
                    }
                }
            } {
                if (!map.containsKey(i)) {
                    int d1=Math.abs(x - i);
                    int d2=Math.abs(x - ans);
                    if (d1<d2 || (d1==d2 && i<ans)) {
                        ans = i;
                        break;
                    }
                }
            } if (!map.containsKey(i)) {
                    int d1=Math.abs(x - i);
                    int d2=Math.abs(x - ans);
                    if (d1<d2 || (d1==d2 && i<ans)) {
                        ans = i;
                        break;
                    }
                } !map.containsKey(i) map.containsKey(i) map.containsKey map i {
                    int d1=Math.abs(x - i);
                    int d2=Math.abs(x - ans);
                    if (d1<d2 || (d1==d2 && i<ans)) {
                        ans = i;
                        break;
                    }
                } int d1=Math.abs(x - i); d1 Math.abs(x - i) Math.abs Math x - i x i int d2=Math.abs(x - ans); d2 Math.abs(x - ans) Math.abs Math x - ans x ans if (d1<d2 || (d1==d2 && i<ans)) {
                        ans = i;
                        break;
                    } d1<d2 || (d1==d2 && i<ans) d1<d2 d1 d2 (d1==d2 && i<ans) d1==d2 d1 d2 i<ans i ans {
                        ans = i;
                        break;
                    } ans = i ans i break; out.println(ans) out.println out ans public static void main(String args[]) {
        int t = 1;
        while (t-- > 0) {
            solve();
        }
        out.close();
    } main {
        int t = 1;
        while (t-- > 0) {
            solve();
        }
        out.close();
    } int t = 1; t 1 while (t-- > 0) {
            solve();
        } t-- > 0 t-- t 0 {
            solve();
        } solve() solve out.close() out.close out String args[] args static class trie {
        trie a[] = new trie[26];
        int cnt = 0;
    } trie trie a[] = new trie[26]; a new trie[26] 26 int cnt = 0; cnt 0 public class Main {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 32768);
    static PrintWriter out = new PrintWriter(System.out);
    static StringTokenizer t;

    static String sn() {
        while (t == null || !t.hasMoreTokens()) {
            try {
                t = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            }
        }
        return t.nextToken();
    }

    static int ni() {
        return Integer.parseInt(sn());
    }

    static long nlo() {
        return Long.parseLong(sn());
    }

    static long mod = (long) 1000000007;

    static long pro(long a, long b) {
        return (a % mod * b % mod) % mod;
    }

    static long add(long a, long b) {
        return (a + b) % mod;
    }

    static long sub(long a, long b) {
        return ((a % mod - b % mod) + mod) % mod;
    }

    static int pow(int n) {
        return (int) (Math.log10(n) / Math.log10(2));
    }

    static int modpow(int x, int y) {
        int res = 1;
//        x %= mod;
        while (y > 0) {
            if (y % 2 != 0)
                res *= x;
            x = x * x;
            y /= 2;
        }
        return res;
    }

//    static class pair {
//        String a;
//        int b;
//
//        pair(String x, int y) {
//            a = x;
//            b = y;
//        }
//    }

    static long modInverse(long n) {
        BigInteger n1 = new BigInteger(Long.toString(n));
        String s = (n1.modInverse(new BigInteger(Long.toString(mod)))).toString();
        return Long.parseLong(s) % mod;
    }

    static boolean v[] = new boolean[1000005];

    static void seive() {
        v[1] = true;
        for (int i = 2; i < 1000005; i++) {
            if (!v[i]) {
                for (int j = 2 * i; j < 1000005; j += i)
                    v[j] = true;
            }
        }
    }

    static boolean isprime(long n) {
        if (n == 1)
            return false;
        for (int i = 2; i * i <= n; i++) {
            if (n % i == 0)
                return false;
        }
        return true;
    }

    static int gcd(int a, int b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    static DecimalFormat df = new DecimalFormat("0.000000000000000000000");

    static class trie {
        trie a[] = new trie[26];
        int cnt = 0;
    }

    static int maxn = (int) 3e5 + 5;

    static long gcd(long a, long b) {
        if (b == 0)
            return a;
        else
            return gcd(b, a % b);
    }

    static void solve() {
        int x = ni();
        int n = ni();
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            map.put(ni(), 1);
        }
        if (n == 0)
            out.println(x);
        else {
            int ans = -1;
            for (int i = x; i <= 1000; i++) {
                if (!map.containsKey(i)) {
                    ans = i;
                    break;
                }
            }
            for (int i = x - 1; i >= -1000; i--) {
                if (!map.containsKey(i)) {
                    int d1=Math.abs(x - i);
                    int d2=Math.abs(x - ans);
                    if (d1<d2 || (d1==d2 && i<ans)) {
                        ans = i;
                        break;
                    }
                }
            }
            out.println(ans);
        }
    }

    public static void main(String args[]) {
        int t = 1;
        while (t-- > 0) {
            solve();
        }
        out.close();
    }
} public class Main {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 32768);
    static PrintWriter out = new PrintWriter(System.out);
    static StringTokenizer t;

    static String sn() {
        while (t == null || !t.hasMoreTokens()) {
            try {
                t = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            }
        }
        return t.nextToken();
    }

    static int ni() {
        return Integer.parseInt(sn());
    }

    static long nlo() {
        return Long.parseLong(sn());
    }

    static long mod = (long) 1000000007;

    static long pro(long a, long b) {
        return (a % mod * b % mod) % mod;
    }

    static long add(long a, long b) {
        return (a + b) % mod;
    }

    static long sub(long a, long b) {
        return ((a % mod - b % mod) + mod) % mod;
    }

    static int pow(int n) {
        return (int) (Math.log10(n) / Math.log10(2));
    }

    static int modpow(int x, int y) {
        int res = 1;
//        x %= mod;
        while (y > 0) {
            if (y % 2 != 0)
                res *= x;
            x = x * x;
            y /= 2;
        }
        return res;
    }

//    static class pair {
//        String a;
//        int b;
//
//        pair(String x, int y) {
//            a = x;
//            b = y;
//        }
//    }

    static long modInverse(long n) {
        BigInteger n1 = new BigInteger(Long.toString(n));
        String s = (n1.modInverse(new BigInteger(Long.toString(mod)))).toString();
        return Long.parseLong(s) % mod;
    }

    static boolean v[] = new boolean[1000005];

    static void seive() {
        v[1] = true;
        for (int i = 2; i < 1000005; i++) {
            if (!v[i]) {
                for (int j = 2 * i; j < 1000005; j += i)
                    v[j] = true;
            }
        }
    }

    static boolean isprime(long n) {
        if (n == 1)
            return false;
        for (int i = 2; i * i <= n; i++) {
            if (n % i == 0)
                return false;
        }
        return true;
    }

    static int gcd(int a, int b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    static DecimalFormat df = new DecimalFormat("0.000000000000000000000");

    static class trie {
        trie a[] = new trie[26];
        int cnt = 0;
    }

    static int maxn = (int) 3e5 + 5;

    static long gcd(long a, long b) {
        if (b == 0)
            return a;
        else
            return gcd(b, a % b);
    }

    static void solve() {
        int x = ni();
        int n = ni();
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            map.put(ni(), 1);
        }
        if (n == 0)
            out.println(x);
        else {
            int ans = -1;
            for (int i = x; i <= 1000; i++) {
                if (!map.containsKey(i)) {
                    ans = i;
                    break;
                }
            }
            for (int i = x - 1; i >= -1000; i--) {
                if (!map.containsKey(i)) {
                    int d1=Math.abs(x - i);
                    int d2=Math.abs(x - ans);
                    if (d1<d2 || (d1==d2 && i<ans)) {
                        ans = i;
                        break;
                    }
                }
            }
            out.println(ans);
        }
    }

    public static void main(String args[]) {
        int t = 1;
        while (t-- > 0) {
            solve();
        }
        out.close();
    }
} Main
import javax.swing.plaf.metal.MetalInternalFrameTitlePane;
import java.math.BigInteger;
import java.util.*;
import java.io.*;
import java.text.*;

public class Main {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 32768);
    static PrintWriter out = new PrintWriter(System.out);
    static StringTokenizer t;

    static String sn() {
        while (t == null || !t.hasMoreTokens()) {
            try {
                t = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            }
        }
        return t.nextToken();
    }

    static int ni() {
        return Integer.parseInt(sn());
    }

    static long nlo() {
        return Long.parseLong(sn());
    }

    static long mod = (long) 1000000007;

    static long pro(long a, long b) {
        return (a % mod * b % mod) % mod;
    }

    static long add(long a, long b) {
        return (a + b) % mod;
    }

    static long sub(long a, long b) {
        return ((a % mod - b % mod) + mod) % mod;
    }

    static int pow(int n) {
        return (int) (Math.log10(n) / Math.log10(2));
    }

    static int modpow(int x, int y) {
        int res = 1;
//        x %= mod;
        while (y > 0) {
            if (y % 2 != 0)
                res *= x;
            x = x * x;
            y /= 2;
        }
        return res;
    }

//    static class pair {
//        String a;
//        int b;
//
//        pair(String x, int y) {
//            a = x;
//            b = y;
//        }
//    }

    static long modInverse(long n) {
        BigInteger n1 = new BigInteger(Long.toString(n));
        String s = (n1.modInverse(new BigInteger(Long.toString(mod)))).toString();
        return Long.parseLong(s) % mod;
    }

    static boolean v[] = new boolean[1000005];

    static void seive() {
        v[1] = true;
        for (int i = 2; i < 1000005; i++) {
            if (!v[i]) {
                for (int j = 2 * i; j < 1000005; j += i)
                    v[j] = true;
            }
        }
    }

    static boolean isprime(long n) {
        if (n == 1)
            return false;
        for (int i = 2; i * i <= n; i++) {
            if (n % i == 0)
                return false;
        }
        return true;
    }

    static int gcd(int a, int b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    static DecimalFormat df = new DecimalFormat("0.000000000000000000000");

    static class trie {
        trie a[] = new trie[26];
        int cnt = 0;
    }

    static int maxn = (int) 3e5 + 5;

    static long gcd(long a, long b) {
        if (b == 0)
            return a;
        else
            return gcd(b, a % b);
    }

    static void solve() {
        int x = ni();
        int n = ni();
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            map.put(ni(), 1);
        }
        if (n == 0)
            out.println(x);
        else {
            int ans = -1;
            for (int i = x; i <= 1000; i++) {
                if (!map.containsKey(i)) {
                    ans = i;
                    break;
                }
            }
            for (int i = x - 1; i >= -1000; i--) {
                if (!map.containsKey(i)) {
                    int d1=Math.abs(x - i);
                    int d2=Math.abs(x - ans);
                    if (d1<d2 || (d1==d2 && i<ans)) {
                        ans = i;
                        break;
                    }
                }
            }
            out.println(ans);
        }
    }

    public static void main(String args[]) {
        int t = 1;
        while (t-- > 0) {
            solve();
        }
        out.close();
    }
}

