#include using namespace std; typedef int64_t ll; ll n,k; int main() { cin>>n>>k; for(ll i=0;i>a>>b; } cout<<(k>n ? -1 : k-1)<