An Animal Contest 1 P3 - Happy Alpacas

View as PDF

Submit solution


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

Author:
Problem types

Night has fallen, and N alpacas have gathered around a campfire. They sit in a circle, that is, alpaca 1 is to the right of alpaca N, alpaca 2 is to the right of alpaca 1, alpaca 3 is to the right of alpaca 2, and so on. Each alpaca is waiting to be assigned a happiness index, h_i. The i^\text{th} alpaca is happy if the sum of its happiness index and the happiness index of the alpaca to its right is even. Otherwise, it is sad. Being a diligent herdsman, you decide to assign each of the N alpacas a happiness index such that there are exactly X happy alpacas.

Constraints

2 \le N \le 10^6

0 \le X \le N

Subtask 1 [15%]

2 \le N \le 15

Subtask 2 [85%]

No additional constraints.

Input Specification

The first line contains two space-separated integers, N and X.

Output Specification

If no solution exists, output -1. Otherwise, output N space-separated integers, the happiness index h_i for the i^{th} alpaca (0 \le h_i \le 10^9). If there are multiple solutions, output any.

Note: Output must end with a newline with no trailing whitespace.

Sample Input 1

6 4

Sample Output 1

7 27 196 50 3 17

Explanation for Sample Output 1

The happy alpacas in this arrangement are alpaca 1, alpaca 3, alpaca 5, and alpaca 6. Note that this is not the only solution.

Sample Input 2

2 1

Sample Output 2

-1

Comments

There are no comments at the moment.