Codeforces Round 166 (Div. 2)
C
Secret
Codeforces
1500
原题
← BD →
翻译中…

The Greatest Secret Ever consists of $*n*$ words, indexed by positive integers from $1$ to $*n*$. The secret needs dividing between $*k*$ Keepers (let's index them by positive integers from $1$ to $*k*$), the $*i*$-th Keeper gets a non-empty set of words with numbers from the set $*U*_{*i*} = (*u*_{*i*, 1}, *u*_{*i*, 2}, ..., *u*_{*i*, |*U*_{*i*}|})$. Here and below we'll presuppose that the set elements are written in the increasing order.

翻译中…

We'll say that the secret is safe if the following conditions are hold:

翻译中…
  • for any two indexes $*i*, *j*$ ($1 ≤ *i* < *j* ≤ *k*$) the intersection of sets $*U*_{*i*}$ and $*U*_{*j*}$ is an empty set;
  • the union of sets $*U*_{1}, *U*_{2}, ..., *U*_{*k*}$ is set $(1, 2, ..., *n*)$;
  • in each set $*U*_{*i*}$, its elements $*u*_{*i*, 1}, *u*_{*i*, 2}, ..., *u*_{*i*, |*U*_{*i*}|}$ do not form an arithmetic progression (in particular, $|*U*_{*i*}| ≥ 3$ should hold).
翻译中…

Let us remind you that the elements of set $(*u*_{1}, *u*_{2}, ..., *u*_{*s*})$ form an arithmetic progression if there is such number $*d*$, that for all $*i*$ ($1 ≤ *i* < *s*$) fulfills $*u*_{*i*} + *d* = *u*_{*i* + 1}$. For example, the elements of sets $(5)$, $(1, 10)$ and $(1, 5, 9)$ form arithmetic progressions and the elements of sets $(1, 2, 4)$ and $(3, 6, 8)$ don't.

翻译中…

Your task is to find any partition of the set of words into subsets $*U*_{1}, *U*_{2}, ..., *U*_{*k*}$ so that the secret is safe. Otherwise indicate that there's no such partition.

翻译中…

Input

翻译中…

The input consists of a single line which contains two integers $*n*$ and $*k*$ ($2 ≤ *k* ≤ *n* ≤ 10^{6}$) — the number of words in the secret and the number of the Keepers. The numbers are separated by a single space.

翻译中…

Output

翻译中…

If there is no way to keep the secret safe, print a single integer "-1" (without the quotes). Otherwise, print $*n*$ integers, the $*i*$-th of them representing the number of the Keeper who's got the $*i*$-th word of the secret.

翻译中…

If there are multiple solutions, print any of them.

翻译中…

样例

Input #1
11 3
Output #1
3 1 2 1 1 2 3 2 2 3 1
InputCopy OutputCopy
Input #2
5 2
Output #2
-1
InputCopy OutputCopy
题目信息
题号
271C
时间限制
2 s
内存限制
256 MB
标签
构造
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。