Problem D. Diversify start positions

Author:I. Tuphanov   Time limit:1 sec
Input file:input.txt   Memory limit:256 Mb
Output file:output.txt  

Statement

New Vasuki Challenge (NVC) is a race developed to make New Vasuki a new racing capital of the world. An outstanding feature of NVC is the distribution of start positions.

Let n be the number of cars taking place in NVC during the whole season. Each car has its id — integer number in range from 1 to n. A season consists of x races. Before a race each car takes a start position. There are n start positions, numbered from 1 to n.

In the beginning of a new season NVC director declares a permutation P = (p1, p2, …, pn). Before the first race car number i takes start position number i for each i from 1 to n. Before each next race start positions are permuted according to P: car which was on start position pi in the last race now goes to start position i.

Say, n = 6, x = 3, P = (4, 3, 6, 5, 1, 2). So, there will be three races and cars will stand in positions (1, 2, 3, 4, 5, 6) before the first race, (4, 3, 6, 5, 1, 2) before the second race, and (5, 6, 2, 1, 4, 3) before the third race.

A permutation P of size n is called feasible for given x iff:

For the example given above, (4, 3, 6, 5, 1, 2) is feasible because all three start position distributions are different, and if there were a forth race the distribution would be (1, 2, 3, 4, 5, 6) which already met in the first race.

Your task is to find a feasible permutation P for given n and x. If there are multiple solutions, output any of them.

Input file format

Input file contains two integers n and x.

Output file format

Output file must contain a feasible permutation. If a feasible permutation doesn't exist, output a single integer  − 1.

Constraints

2 ≤ n ≤ 103

2 ≤ x ≤ 106

Sample tests

No. Input file (input.txt) Output file (output.txt)
1
6 3
4 3 6 5 1 2

0.069s 0.012s 13