#include #include #include #include #include #include #define MP make_pair using ll = long long; using namespace std; int main() { int n,m; cin >> n >> m; int cnt=0; for(;;){ cnt++; if(n/(pow(2,cnt)) <= m) break; } if(n <= m) cout << 1 << endl; else if(n%2==1) cout << -1 << endl; else cout << 2*cnt << endl; return 0; }