//================================================= includes ===================================================//
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
using namespace std;
//=========================================================== define =======================================================================================//
#define Essam_z ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
#define nl cout << '\n';
#define ll long long
#define ld long double
#define str string
#define YES cout << "YES\n";
#define NO cout << "NO\n";
#define fxd(n) fixed << setprecision(n) // cout
#define pi 3.14159265359
#define loopr(i, a, b) for(int i = a; i <= b; ++i)
#define loop(i, n) for(int i = 0; i < n; ++i)
#define sorts(X) sort(X.begin(), X.end())
#define sortt(X, n) sort(X, X + n)
#define rev(X, n) reverse(X, X + n)
#define all(X) X.begin(), X.end()
#define sz size()
#define F first
#define S second
//=========================================================== functions =======================================================================================//
ll gcd( ll a, ll b) {
if ( b == 0 ) return a;
return gcd( b, a % b) ;
}
ll lcm( ll a, ll b) {
return ( a / gcd( a, b) ) * b;
}
ll sums( ll n) {
return ( n * ( n + 1 ) / 2 ) ;
}
ll sumrng( ll n, ll m) {
return ( ( ( n + m) * ( m - n + 1 ) ) / 2 ) ;
}
ll sumodd( ll n) {
ll res = ( n + 1 ) / 2 ;
return res * res;
}
ll sumeven( ll n) {
n / = 2 ;
ll res = n * ( n + 1 ) ;
return res;
}
ll fact( ll n) {
if ( n == 0 || n == 1 ) return 1 ;
return n * fact( n - 1 ) ;
}
bool isprime( ll n) {
if ( n <= 1 ) return false ;
for ( ll i = 2 ; i * i <= n; ++ i) {
if ( n % i == 0 ) return false ;
}
return true ;
}
bool ispalindrom( str s) {
int i = 0 , j = s.size ( ) - 1 ;
while ( i <= j) {
if ( s[ i] ! = s[ j] ) return false ;
++ i;
-- j;
}
return true ;
}
bool islucky( int n) {
while ( n > 0 ) {
if ( n % 10 ! = 4 && n % 10 ! = 7 ) return false ;
n / = 10 ;
}
return true ;
}
ll npr( ll n, ll r) {
return fact( n) / fact( n - r) ;
}
ll ncr( ll n, ll r) {
return fact( n) / ( fact( r) * fact( n - r) ) ;
}
ll diff_strings( str s1, str s2) {
ll sum = 0 ;
for ( int i = 0 ; i < s1.sz ; ++ i) {
sum + = abs ( s1[ i] - s2[ i] ) ;
}
return sum;
}
ll sum_div_x( ll a, ll b, ll x) {
ll mx = max( a, b) ;
ll mn = min( a, b) ;
ll sum = ( sums( mx / x) * x) - ( sums( ( mn - 1 ) / x) ) * x;
return sum;
}
int dx[ ] = {
- 1 , - 1 , - 1 ,
0 , 0 ,
1 , 1 , 1
} ; // for checking grid
int dy[ ] = {
- 1 , 0 , 1 ,
- 1 , 1 ,
- 1 , 0 , 1
} ;
//============================================================= // I am Not tourist // ===============================================================//
int main( ) {
int n,k; cin >> n>> k;
int freq[ 2 ] [ 200001 ] { 0 } ;
for ( int i = 0 ; i < n; i++ )
{
int num; cin >> num;
freq[ 1 ] [ num] ++ ;
}
for ( int i = - k ; i <= k ; i++ )
{
if ( freq[ 1 ] [ i] == 0 )
{
cout << i;
break ;
}
}
return 0 ;
}
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAovLz09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gaW5jbHVkZXMgPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ly8KCiNpbmNsdWRlIDxiaXRzL3N0ZGMrKy5oPgojaW5jbHVkZSA8aW9zdHJlYW0+CiNpbmNsdWRlIDx2ZWN0b3I+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgovLz09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09IGRlZmluZSA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0vLwoKI2RlZmluZSBFc3NhbV96IGlvc19iYXNlOjpzeW5jX3dpd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LyBnY2QoYSwgYikpICogYjsKfQpsbCBzdW1zKGxsIG4pIHsKICAgIHJldHVybiAobiAqIChuICsgMSkgLyAyKTsKfQpsbCBzdW1ybmcobGwgbiwgbGwgbSkgewogICAgcmV0dXJuICgoKG4gKyBtKSAqIChtIC0gbiArIDEpKSAvIDIpOwp9CmxsIHN1bW9kZChsbCBuKSB7CiAgICBsbCByZXMgPSAobiArIDEpIC8gMjsKICAgIHJldHVybiByZXMgKiByZXM7Cn0KbGwgc3VtZXZlbihsbCBuKSB7CiAgICBuIC89IDI7CiAgICBsbCByZXMgPSBuICogKG4gKyAxKTsKICAgIHJldHVybiByZXM7Cn0KbGwgZmFjdChsbCBuKSB7CiAgICBpZiAobiA9PSAwIHx8IG4gPT0gMSkgcmV0dXJuIDE7CiAgICByZXR1cm4gbiAqIGZhY3QobiAtIDEpOwp9CmJvb2wgaXNwcmltZShsbCBuKSB7CiAgICBpZiAobiA8PSAxKSByZXR1cm4gZmFsc2U7CiAgICBmb3IgKGxsIGkgPSAyOyBpICogaSA8PSBuOyArK2kpIHsKICAgICAgICBpZiAobiAlIGkgPT0gMCkgcmV0dXJuIGZhbHNlOwogICAgfQogICAgcmV0dXJuIHRydWU7Cn0KYm9vbCBpc3BhbGluZHJvbShzdHIgcykgewogICAgaW50IGkgPSAwLCBqID0gcy5zaXplKCkgLSAxOwogICAgd2hpbGUgKGkgPD0gaikgewogICAgICAgIGlmIChzW2ldICE9IHNbal0pIHJldHVybiBmYWxzZTsKICAgICAgICArK2k7CiAgICAgICAgLS1qOwogICAgfQogICAgcmV0dXJuIHRydWU7Cn0KYm9vbCBpc2x1Y2t5KGludCBuKSB7CiAgICB3aGlsZSAobiA+IDApIHsKICAgICAgICBpZiAobiAlIDEwICE9IDQgJiYgbiAlIDEwICE9IDcpIHJldHVybiBmYWxzZTsKICAgICAgICBuIC89IDEwOwogICAgfQogICAgcmV0dXJuIHRydWU7Cn0KbGwgbnByKGxsIG4sIGxsIHIpIHsKICAgIHJldHVybiBmYWN0KG4pIC8gZmFjdChuIC0gcik7Cn0KbGwgbmNyKGxsIG4sIGxsIHIpIHsKICAgIHJldHVybiBmYWN0KG4pIC8gKGZhY3QocikgKiBmYWN0KG4gLSByKSk7Cn0KbGwgZGlmZl9zdHJpbmdzKHN0ciBzMSwgc3RyIHMyKSB7CiAgICBsbCBzdW0gPSAwOwogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBzMS5zejsgKytpKSB7CiAgICAgICAgc3VtICs9IGFicyhzMVtpXSAtIHMyW2ldKTsKICAgIH0KICAgIHJldHVybiBzdW07Cn0KbGwgc3VtX2Rpdl94KGxsIGEsIGxsIGIsIGxsIHgpIHsKICAgIGxsIG14ID0gbWF4KGEsIGIpOwogICAgbGwgbW4gPSBtaW4oYSwgYik7CiAgICBsbCBzdW0gPSAoc3VtcyhteCAvIHgpICogeCkgLSAoc3VtcygobW4gLSAxKSAvIHgpKSAqIHg7CiAgICByZXR1cm4gc3VtOwp9CmludCBkeFtdPXsKICAgIC0xLCAtMSwgLTEsCiAgICAgMCwgIDAsCiAgICAgMSwgIDEsICAxCn07IC8vIGZvciBjaGVja2luZyBncmlkCmludCBkeVtdPXsKICAgIC0xLCAwLCAxLAogICAgLTEsIDEsCiAgICAtMSwgMCwgMQp9OwoKLy89PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ICAvLyBJIGFtIE5vdCB0b3VyaXN0IC8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PS8vCgoKaW50IG1haW4oKSB7CgppbnQgbixrOyBjaW4+Pm4+Pms7CgoKaW50IGZyZXFbMl1bMjAwMDAxXXswfTsKCgoKZm9yIChpbnQgaSA9IDAgOyBpIDwgbjsgaSsrKQp7CiAgICBpbnQgbnVtOyBjaW4+Pm51bTsgCgogICAgZnJlcVsxXVtudW1dKys7CgoKCn0KCgoKZm9yIChpbnQgaSA9IC1rIDsgaSA8PWsgOyBpKyspCnsKICAgIGlmIChmcmVxWzFdW2ldPT0wKQogICAgewogICAgICAgIGNvdXQ8PGk7CgogICAgICAgIGJyZWFrOwogICAgfQp9CgogICAgcmV0dXJuIDA7Cn0=