#include using namespace std; using ll = long long; vector S; ll N,Y,y,z; ll f(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)(f((R+L)/2)>=Y?R:L)=(R+L)/2; cout<<(f(R)==Y?R:-1)<