题目描述
Problem Description
Takahashi organized a programming contest with $ N $ participants. Feeling that the contest would be incomplete without prizes, Takahashi decided to award a special prize to the "K-th youngest person among those ranked $ i $ or higher". He already knows the ages of all participants. The value of $ K $ has already been decided, but the value of $ i $ has not. To decide the value of $ i $, Takahashi decided to calculate who would receive the special prize for each integer $ i $ from $ K $ to $ N $.
Input Format
The input is given from the standard input in the following format:
$ N $ $ K $ $ X_1 $ $ X_2 $ ... $ X_N $
- The first line contains two integers $N\ (1\ ≦\ N\ ≦\ 100,000)$ representing the number of participants and $K\ (1\ ≦\ K\ ≦\ N)$, separated by a space.
- The second line contains $ N $ integers separated by spaces, representing the age information of the participants. The $ i $-th integer $X_i\ (1\ ≦\ X_i\ ≦\ N)$ indicates that the participant ranked $ i $ is the $ X_i $-th youngest among all participants. It is guaranteed that $X_p\ \neq\ X_q$ when $p\ \neq\ q$.
Output Format
Output $ N-K+1 $ lines. The $ i $-th line should contain a single integer representing the rank of the "K-th youngest person among those ranked $ i+K-1 $ or higher".
Sample Input and Output
Sample Input #1
5 2
4 5 3 1 2
Sample Output #1
2
1
3
5
Sample Input #2
3 1
2 3 1
Sample Output #2
1
1
3
Notes/Hints
Partial Points
This problem has partial points.
- If you correctly solve all test cases where $N\ ≦\ 1000$, you will be awarded $ 40 $ points.
Sample Explanation 1
Here is an explanation for each line of the output:
- Line 1: The 2nd youngest person among those ranked 2nd or higher is the person ranked 2nd.
- Line 2: The 2nd youngest person among those ranked 3rd or higher is the person ranked 1st.
- Line 3: The 2nd youngest person among those ranked 4th or higher is the person ranked 3rd.
- Line 4: The 2nd youngest person among those ranked 5th or higher is the person ranked 5th.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分