#include using namespace std; int main(){ int n, m; cin >> n >> m; if(m >= n) cout << 1 << endl; else if((n+1)/2 <= m && n > 3) cout << 2 << endl; else cout << -1 << endl; return 0; }