#P9632. [ICPC 2020 Nanjing R] K Co-prime Permutation
[ICPC 2020 Nanjing R] K Co-prime Permutation
题目描述
Kotori is very good at math (really?) and she loves playing with permutations and primes.
One day, she thinks of a special kind of permutation named . A permutation of is called a co-prime permutation of if there exists exactly integers such that and , where indicates the greatest common divisor of and .
Given and , please help Kotori construct a co-prime permutation of or just report that there is no such permutation.
Recall that a permutation of is a sequence of length containing all integers from to .
输入格式
There is only one test case in each test file.
The first and only line contains two integers and (, ).
输出格式
Output one line containing integers separated by one space, indicating the permutation satisfying the given constraints. If no such permutation exists output -1
(without quotes) instead. If there are multiple valid answers you can print any of them.
Please, DO NOT output extra spaces at the end of each line, otherwise your answer may be considered incorrect!
5 3
1 4 5 2 3
1 0
-1