#include #define PI 3.14159265359 #define NIL -1 using namespace std; const int64_t MOD = 1e9 + 7; int main() { int N,K; cin >> N >> K; if (N < K) { cout << -1 << endl; } else { cout << K - 1 << endl; } }