#P9591. Banana XOR Journey

    ID: 22738 Type: Default 1000ms 256MiB

Banana XOR Journey

Banana XOR Journey

A new journey begins: Banana-chaser Zhili has embarked on a quest to find bananas. There are n bananas arranged along the road, numbered from 1 to n. Zhili is very excited to see so many delicious bananas; however, he wants to eat exactly m bananas so that he is neither too full nor too hungry.

Being a picky eater, Zhili will be satisfied if and only if the xor of the m chosen banana numbers is exactly $$2^{\lfloor \log_2 n\rfloor+1}-1$$. In other words, you are given two integers n and m. Please select exactly m distinct numbers from the range \([1, n]\) whose xor sum is equal to $$2^{\lfloor \log_2 n\rfloor+1}-1$$. If no such selection exists, output -1.

Input Format

The input contains two space‐separated integers n and m.

Output Format

If there exists a valid selection, output m space‐separated integers (in any order) representing the numbers of the bananas that Zhili should eat. Otherwise, output -1.

inputFormat

The input consists of a single line containing two integers n and m.

outputFormat

If a valid selection exists, output m space‐separated numbers from 1 to n whose xor is exactly $$2^{\lfloor \log_2 n\rfloor+1}-1$$. If such a subset does not exist, output -1.

sample

7 1
7