#arc106c. [arc106_c]Solutions

[arc106_c]Solutions

Problem Statement

Two segments \[L_1:R_1\] and \[L_2:R_2\] are said to intersect when L1leqR2L_1 \\leq R_2 and L2leqR1L_2 \\leq R_1 holds.

Consider the following problem PP:

Input: NN segments \[L_1: R_1\], \\cdots, \[L_N:R_N\] L1,L2,cdots,LN,R1,R2,cdots,RNL_1, L_2, \\cdots, L_N, R_1, R_2, \\cdots, R_N are pairwise distinct. Output: the maximum number of segments that can be chosen so that no two of them intersect.

Takahashi has implemented a program that works as follows:

Sort the given segments in the increasing order of RiR_i and let the result be $\[L_{p_1}:R_{p_1}\], \[L_{p_2}:R_{p_2}\], \\cdots , \[L_{p_N}:R_{p_N}\]$. For each i=1,2,cdots,Ni = 1, 2, \\cdots , N, do the following: Choose \[L_{p_i}:R_{p_i}\] if it intersects with none of the segments chosen so far. Print the number of chosen segments.

Aoki, on the other hand, has implemented a program that works as follows:

Sort the given segments in the increasing order of LiL_i and let the result be $\[L_{p_1}:R_{p_1}\], \[L_{p_2}:R_{p_2}\], \\cdots , \[L_{p_N}:R_{p_N}\]$. For each i=1,2,cdots,Ni = 1, 2, \\cdots , N, do the following: Choose \[L_{p_i}:R_{p_i}\] if it intersects with none of the segments chosen so far. Print the number of chosen segments.

Given are integers NN and MM. Construct an input for the problem PP, consisting of NN segments, such that the following holds:

$$(\\text{The value printed by Takahashi's program}) - (\\text{The value printed by Aoki's program}) = M $$

Constraints

  • All values in input are integers.
  • 1leqNleq2times1051 \\leq N \\leq 2 \\times 10^5
  • \-NleqMleqN\-N \\leq M \\leq N

Input

Input is given from Standard Input in the following format:

NN MM

Output

If there is no set of NN segments that satisfies the condition, print -1.

Otherwise, print NN lines as follows:

L1L_1 R1R_1 L2L_2 R2R_2 vdots\\vdots LNL_N RNR_N

Here, \[L_1:R_1\], \\cdots, \[L_N:R_N\] must satisfy the following:

  • 1leqLi<Rileq1091 \\leq L_i < R_i \\leq 10^9
  • LineqLjL_i \\neq L_j (ineqji \\neq j)
  • RineqRjR_i \\neq R_j (ineqji \\neq j)
  • LineqRjL_i \\neq R_j
  • L1,cdots,LN,R1,cdots,RNL_1, \\cdots , L_N , R_1, \\cdots , R_N are integers (21:46 added)

If there are multiple answers, any of them will be accepted.

Be sure to print a newline at the end of the output.


Sample Input 1

5 1

Sample Output 1

1 10
8 12
13 20
11 14
2 4

Let us call the five segments Segment 11, Segment 22, cdots\\cdots, Segment 55.

Takahashi's program will work as follows:

Rearrange the segments into the order Segment 55, Segment 11, Segment 22, Segment 44, Segment 33. Choose Segment 55. Skip Segment 11 (because it intersects with Segment 55). Choose Segment 22. Skip Segment 44 (because it intersects with Segment 22). Choose Segment 33.

Thus, Takahashi's program will print 33.

Aoki's program will work as follows:

Rearrange the segments into the order Segment 11, Segment 55, Segment 22, Segment 44, Segment 33. Choose Segment 11. Skip Segment 55 (because it intersects with Segment 11). Skip Segment 22 (because it intersects with Segment 11). Choose Segment 44. Skip Segment 33 (because it intersects with Segment 44).

Thus, Aoki's program will print 22.

Here, we have 32=1left(=Mright)3 - 2 = 1 \\left(= M \\right), and thus these five segments satisfy the condition.


Sample Input 2

10 -10

Sample Output 2

-1