This page is still under construction.

Parts of this page are still being built. What you see may change.

Turn Game 2

Time limit2sMemory limit512 MB

Summary
Decide whether turn wins of weights 1, 3, 5, ... can give Yunho x and Donghyeok y points, minimizing Yunho's wins.
Level

Medium5 of 10

Topics
Math, Greedy, Number theory
Solved
No attempts yet

Problem

Yunho and Donghyeok are at an algorithm camp. When a problem will not come out, they take a break and play a game.

The game is made of turns, and each turn is won by one of the two players. Turns are numbered from 1, and the winner of turn ii earns 2i−12i-1 points.

The total number of turns is not fixed. Any number of turns is possible, including zero.

You are given two integers xx and yy. Decide whether Yunho can end with xx points and Donghyeok with yy points. If that is possible, also find the smallest number of turns Yunho has to win.

Input

The first line contains two integers xx and yy. (0≤x,y≤10120 \le x, y \le 10^{12})

Output

Print the smallest number of turns Yunho has to win. If scores xx and yy are impossible, print -1.

Examples5

  1. Example 1

    Input
    8 17
    
    Expected output
    2
    
  2. Example 2

    Input
    17 8
    
    Expected output
    3
    
  3. Example 3

    Input
    0 0
    
    Expected output
    0
    
  4. Example 4

    Input
    9 9
    
    Expected output
    -1
    
  5. Example 5

    Input
    500000 500000
    
    Expected output
    294