#include using namespace std; int main() { int N, M; cin >> N >> M; if(N <= M) { cout << 1 << endl; } else if(N % 2 == 0 && M >= N / 2) { cout << 2 << endl; } else { cout << -1 << endl; } }