atcoder#ABC205D. [ABC205D] Kth Excluded
[ABC205D] Kth Excluded
Score : points
Problem Statement
You are given a sequence of positive integers: , and queries.
In the -th query , given a positive integer , find the -th smallest integer among the positive integers that differ from all of .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print lines. The -th line should contain the response to the -th query.
4 3
3 5 6 7
2
5
3
2
9
4
The positive integers that differ from all of are in ascending order. The second, fifth, and third smallest of them are , , and , respectively.
5 2
1 2 3 4 5
1
10
6
15