#include using namespace std; int solve(int n, int m) { if (n <= m) { return 1; } if (n % 2 != 0) { return -1; } if (n / 2 <= m) { return 2; } return -1; } int main () { int n, m; cin >> n >> m; int ret = solve(n, m); cout << ret << endl; }