For any multiset (
may contain duplicated elements) of non-negative integers, define
as the smallest non-negative integer that is not in
.
You are given a sequence of non-negative integers
and
queries.
For any interval (
), let its weight be
.
For each query, you are given an interval and a positive integer
. Find the
-th smallest weight among all subintervals of
.
The first line contains two integers(
), denoting the length of the sequence and the number of queries.
The second line containsnon-negative integers
(
) separated by spaces.
In the followinglines, each line contains three integers
(
), denoting a query.
Outputlines. The
-th line should contain the answer of the
-th query.