#include #define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++) #define REP(i,n) FOR(i,0,n) #define MOD 1000000007 //#define int long long using namespace std; typedef long long ll; typedef vector V; typedef vector VV; const int INF = 1e9; signed main() { int n, m; cin >> n >> m; if (n % 2 == 0) { if (n <= m) { cout << 1 << endl; } else { if (n / 2 <= m) { cout << 2 << endl; } else { cout << -1 << endl; } } } else { if (n == 3) { if (m >= 3) { cout << 1 << endl; return 0; } else { cout << -1 << endl; return 0; } } if (n <= m) { cout << 1 << endl; } else { if (n / 2 + 1 <= m) { cout << 2 << endl; } else { cout << -1 << endl; } } } }