#P9632. K Co-Prime Permutation
K Co-Prime Permutation
K Co-Prime Permutation
Kotori loves playing with permutations and primes! A permutation (p_1, p_2, \cdots, p_n) is called a (k) co-prime permutation of (n) if there exist exactly (k) indices (i) (with (1 \le i \le n)) such that (\gcd(p_i,i)=1). Given (n) and (k), construct a (k) co-prime permutation of (n) or output -1 if no such permutation exists.
A permutation of (n) is a sequence containing all integers from 1 to (n) exactly once.
inputFormat
The input consists of two integers, (n) and (k) (with (1 \le n \le) [reasonable limit] and (1 \le k \le n)).
outputFormat
If a valid permutation exists, output (n) space-separated integers representing the permutation with exactly (k) positions (i) satisfying (\gcd(p_i,i)=1). Otherwise, output -1.
sample
1 1
1