Rated Contest 2 P1 - An Odd Ski Trip

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type

Daniel is planning a ski trip with his friends for New Year's! But first, he must decide which ski resort to stay at... with a twist. Daniel loves odd numbers, so he will only go on ski hills with an odd number height. In addition, Daniel's favorite number is the number M, so he wants the total height of all ski hills to be divisible by M.

Can you help Daniel design a ski resort with N hills, each with a different odd-value height? Each height must be in the range [1, 10^7]—we don't want Daniel and his friends to die if the hill is too tall!

Constraints

Subtask 1 [50%]

1 \le N, M \le 10^3

M is odd.

Subtask 2 [50%]

1 \le N, M \le 10^6

Input Specifications

The first and only line of input contains the integers N and M.

Output Specification

Output N integers on a single line, the heights of the hills. Output -1 if there exists no such solution.

Sample Input

8 5

Sample Output

One possible solution is the following:

5 33 1 9 7 17 19 29

Sample Explanation

Each hill height is a unique odd integer between [1, 10^7], and the sum of all hill heights is 120, which is divisible by 5.


Comments

There are no comments at the moment.