#include #include #include #include #include #include using namespace std; using ll = long long; void solve(); int main() { solve(); #ifdef DBG while (true); #endif } //531 void solve() { int n, m; scanf("%d %d", &n, &m); if (n <= m) printf("1\n"); else if (!(n & 1) && n <= m * 2) printf("2\n"); else printf("-1\n"); }