#include using namespace std; using ll = long long; vector S; ll N,Y; ll calc(ll x){ stack P; for(int i=0;i>N>>Y; S.resize(N); for(auto &s:S)cin>>s; ll L=-1,R=Y+1; while(R-L>1)(calc((R+L)/2)>=Y?R:L)=(R+L)/2; cout<<(calc(R)==Y?R:-1)<