시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB66222135.593%

문제

Find a sequence of steps of the following kind (if it exists) that would make all elements of any array of real numbers a1, a2, . . . , an equal:

pick k distinct indices b1, b2, . . . , bk (1 ≤ bi ≤ n) and change the values of ab1, ab2, . . . , abk to their arithmetic mean (that is, 1/k (ab1 + ab2 + . . . + abk)) simultaneously.

입력

The only line contains two integers n and k (2 ≤ k ≤ n ≤ 1000; n is divisible by k).

출력

If a required sequence of steps doesn’t exist, display a single integer −1.

Otherwise, display the number of steps in your sequence t (1 ≤ kt ≤ 106), followed by t step descriptions. Each step description must consist of k distinct integers b1, b2, . . . , bk (1 ≤ bi ≤ n).

It can be shown that if a valid sequence of steps exists, a sequence satisfying kt ≤ 106 exists as well.

예제 입력 1

4 2

예제 출력 1

4
1 2
3 4
1 3
2 4

예제 입력 2

6 3

예제 출력 2

-1