#include using namespace std; int main(void){ int n,m; cin >> n >> m; if(n >= m){ cout << 1 << endl; }else if( n % 2 ){ cout << -1 << endl; }else if(n / 2 <= m){ cout << 2 << endl; }else{ cout << -1 << endl; } }