#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; } } int main () { int n, m; cin >> n >> m; cout << solve(n, m) << endl; }