ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

Ural Championship 2015

About     Problems     Submit solution     Judge status     Standings
Contest is over

D. Chemistry

Time limit: 1.0 second
Memory limit: 64 MB
Android Vasya attends his Chemistry classes. During the latest semester Vasya’s group is studying dry liquids. At the laboratory work on mixing liquids Vasya has got oxygen oxide. An important feature of this substance is its unpredictable consequences after mixing. The liquid is stable only after mixing it in one to one proportion.
Vasya has got n test tubes, with one nano liter of oxygen oxide in each. Due to the features of the oxide Vasya pours liquids from test tube A to test tube B in such a way that the resulting liquid volume in test tube B doubles. To set the experiment successfully Vasya needs to make exactly k nano liters of the oxide in any of the test tubes. Help him do this.

Input

The only line contains integers n and k (1 ≤ n ≤ 100 000; 1 ≤ kn).

Output

Output the sequence of transfers (i. e. pouring from one test tube to another), which results in exactly k nano liters of the oxide being in the first test tube. In the first line output the number of transfers of the liquid m (0 ≤ m ≤ 3n). Then in m lines output pairs of integers a, b (1 ≤ a, bN), meaning that Vasya needs to pour the oxide from the test tube number a to the test tube number b. If such sequence doesn’t exist output −1. If there are several solutions output any. It is guaranteed that if there is a sequence of transfers to get k nano liters then there is one with no more than 3n transfers.

Samples

inputoutput
5 3
4
2 1
4 3
3 1
1 5
5 5
-1
Problem Author: Daniil Ayzenshteyn (prepared by Egor Shchelkonogov)
Problem Source: Ural Sport Programming Championship 2015
To submit the solution for this problem go to the Problem set: 2049. Chemistry