cho.sh
Notes
Loading...

Candy Jars

Time limit

2s

Memory limit

128 MB

Problem

There are N jars of candy. Jar 1 contains K candies, jar 2 contains K+1 candies, and each next jar contains one more candy than the previous jar. Thus jar N contains K+N-1 candies.

In one operation, choose any nonempty set of jars and remove the same positive number of candies from every chosen jar. The number removed cannot exceed the number of candies currently remaining in any chosen jar.

Find a way to remove all candies using the minimum possible number of operations.

Input

The first line contains two integers N and K: the number of jars and the number of candies in jar 1.

  • 1 <= N <= 100,000
  • 1 <= K <= 500,000

The jars are numbered from 1 to N from left to right.

Output

Print the minimum number of operations M on the first line.

Then print two lines for each operation. The first line of an operation contains the number of selected jars and the number of candies removed from each of them. The second line contains the selected jar numbers separated by spaces.

After all operations are performed in the printed order, every jar must contain exactly 0 candies. If several minimum-operation answers exist, print any one of them.