Wine Tasting

Time limit: 0.3s Memory limit: 64MB Input: Output:

There are NN vineyards arranged in a row, numbered from 00 to N1N-1. Giorgio starts the tour from vineyard LL, once the first tasting is over he will move on to the vineyard L+1L+1, then to the vineyard L+2L+2 and so on until he reaches the vineyard RR. Note that Giorgio can start and end his tour on the same vineyard.

To visit the vineyard ii Giorgio has to pay ViV_i euro. The cost of a tour is the cost of each vineyard visited.

There are a total of N(N+1)2\frac{N \cdot (N+1)}{2} different tours, Giorgio will choose one of the tours in the following way:

First, he sorts the tours in ascending order of cost, in case of a tie, the tours with the smallest starting vineyard come first. Then, he chose the KK-th tour from this order.

Help Giorgio find the first and the last vineyards of the KK-th tour!

Input data

The first line of the input contains the integers NN and KK. The second line contains NN integers ViV_i.

Output data

The output contains a single line which has the integers LL and RR: the first and the last vineyards of Giorgio's tour.

Constraints and clarifications

  • 1N21051 \leq N \leq 2 \cdot 10^5
  • 1KN(N+1)21 \leq K \leq \frac{N \cdot (N+1)}{2}
  • 1Vi1091 \leq V_i \leq 10^9
  • For tests worth 5050 points, ViV_i = 11 for all values in the input.
  • For tests worth 2020 more points, 1N10001 \leq N \leq 1000.

Example 1

stdin

4 4
1 2 3 1

stdout

0 1

Explanation

In the first sample case there are 1010 possible tours, in order:

from 00 to 00: the cost is 11
from 33 to 33: the cost is 11
from 11 to 11: the cost is 22
from 00 to 11: the cost is 1+2=31+2=3
from 22 to 22: the cost is 33
from 22 to 33: the cost is 3+1=43+1=4
from 11 to 22: the cost is 2+3=52+3=5
from 00 to 22: the cost is 1+2+3=61+2+3=6
from 11 to 33: the cost is 2+3+1=62+3+1=6
from 00 to 33: the cost is 1+2+3+1=71+2+3+1=7

The fourth tour starts from vineyard 00 and end in vineyard 11.

Example 2

stdin

6 18
1 2 1 2 1 2

stdout

2 5

Log in or sign up to be able to send submissions!