And Again, Queries
You are given an array of integers and an integer . Your task is to answer queries of the type:
For a given , you must divide the subarray into the minimum number of contiguous segments so that the number of distinct integers in each segment is at most . Each element from to belongs to exactly one segment.
Input
The first line contains three integers , , — the length of , the fixed for each query, and the number of queries, respectively.
The second line contains integers — elements of .
Each of the following lines contains two integers and describing the query.
Output
For each query, output the minimum number of segments it may be divided.
Examples
Note
In the first example, there are queries.
, . We should divide . One of the possible divisions is . The first segment has one distinct number and the second segment has two distinct numbers. Notice that the division is incorrect because this segment contains three distinct numbers while ;
. We should divide . A possible division is ;
. We should divide . A possible division is ;
. We should divide . A possible division is ;
. We should divide . A possible division is .
Scoring
( points): and ;
( points): ;
( points): for all queries;
( points): ;
( points): ;
( points): no additional restrictions.