#P1638. 逛画展
逛画展
Description
The exhibition hall is displaying paintings by the world’s best painters.
When buying a ticket, a visitor must specify two numbers, and , meaning they want to see all paintings from the -th to the -th (inclusive), and the ticket price is one yuan per painting.
Sept hopes that, after entering, he can see paintings by all the master painters. Of course, he wants to minimize the ticket price.
Find the he should choose when buying the ticket. The testdata guarantees that a solution exists.
If multiple solutions exist, output the one with the smallest .
Input Format
The first line contains two integers , denoting the total number of paintings in the exhibition and the number of master painters, respectively.
The second line contains integers , where is the ID of the master who painted the -th painting.
Output Format
One line with two integers .
12 5
2 5 3 1 3 2 4 1 1 5 4 3
2 7
Hint
Constraints
- For 30% of the testdata, , .
- For 60% of the testdata, , .
- For 100% of the testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号