#include #define int long long using namespace std; const int MOD = 1000000007; using Graph = vector>; signed main() { int N, M; cin >> N >> M; if( M >= N ){ cout << 1 << endl; return 0; }else if( N%2 == 0 && M >= N/2 ) cout << 2 << endl; else cout << -1 << endl; }