407888: GYM102916 L Not the Longest Increasing Subsequence

Memory Limit:512 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

L. Not the Longest Increasing Subsequencetime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard output

There is an array of $$$n$$$ integers. Each element $$$a_i$$$ in this array is between $$$1$$$ and $$$k$$$.

What is the smallest number of elements that should be removed from this array, so that its longest increasing subsequence has length smaller than $$$k$$$?

Input

The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 10^6, 1 \le k \le n$$$) — the length of the array and the upper bound for its elements.

The second line contains $$$n$$$ integers $$$a_i$$$ ($$$1 \le a_i \le k$$$) — the elements of the array.

Output

In the first line output an integer $$$m$$$ — the number of elements to remove.

In the second line output $$$m$$$ integers — the indices of the removed elements. The indices are numbered from $$$1$$$ to $$$n$$$.

ExamplesInput
3 2
1 2 2
Output
1
1 
Input
2 2
2 1
Output
0

Input
8 3
1 2 2 1 1 3 2 3
Output
2
1 7 

加入题单

上一题 下一题 算法标签: