#include #define FOR(i,a,b) for(int i = (a); i < (b); ++i) #define REP(i,n) FOR(i,0,n) #define SZ(n) (int)(n).size() #define ALL(n) (n).begin(), (n).end() #define MOD % 1000000007 using namespace std; typedef long long LL; typedef vector VI; int main() { int n, m; cin >> n >> m; int ans = 0; if (m >= n) ans = 1; else if (n / 2 <= m && n % 2 == 0) ans = 2; else ans = -1; cout << ans << endl; return 0; }