#1180
Unrated
KRATKI
시간 제한
1s
메모리 제한
32MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

1 second, 32 MB, 120 points All of you are probably very familiar with the problem of finding the longest monotone subsequence. You probably think you know all about it. In order to convince us, solve the problem “opposite” to finding the longest monotone subsequence. For given N and K, find the sequence that consists of numbers from 1 to N such that each of the numbers in it appears exactly once and the length of its longest monotone subsequence (ascending or descending) is exactly K.

입력

The first line of input contains the integers N and K (1 ⩽K ⩽N ⩽106), the length of the sequence and the required length of the longest monotone subsequence.

출력

If the required sequence doesn’t exist, output -1 in the first and only line. If the required sequence exists, output the required sequence of N numbers in the first and only line. Separate the numbers with a single space. The required sequence (if it exists) is not necessarily unique, so you can output any valid sequence.

예제 입력 1

4 3

예제 출력 1

1 4 2 3

예제 입력 2

5 1

예제 출력 2

-1

예제 입력 3

5 5

예제 출력 3

1 2 3 4 5
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.