5588: CF EDU - Two Pointer Method - Step 3 - A. Looped Playlist
[Creator : ]
Description
Misha listens to music on his player, his playlist consists of $n$ songs that are played in a specific order. After the last song ends, the first one starts playing. Each song has its own characteristic, positivity $a_i$, given by an integer. After listening to the $i$-h song, Misha's mood increases by $a_i$.
Misha can start listening to any of the songs and listen to any number of songs in a row, while he may listen to some songs more than once.
Misha feels happy if his mood after listening to the songs has increased by at least $p$. He wants to feel happy listening to as few songs as possible. Help him choose the song to start listening to and the number of songs to listen to to be happy.
Misha can start listening to any of the songs and listen to any number of songs in a row, while he may listen to some songs more than once.
Misha feels happy if his mood after listening to the songs has increased by at least $p$. He wants to feel happy listening to as few songs as possible. Help him choose the song to start listening to and the number of songs to listen to to be happy.
Input
The first line contains two integers $n, p\ (1 ≤n≤ 1000,\ 1 ≤p≤ 10^{18})$, the number of songs in the playlist and the amount that Misha wants increase his mood.
The second line contains $n$ integers $a_i\ (1 ≤a_i≤ 10^9)$, positivity of the songs.
The second line contains $n$ integers $a_i\ (1 ≤a_i≤ 10^9)$, positivity of the songs.
Output
Print two numbers, the index of the song $k$, with which you should start listening, and the number of songs $c$, which you should listen to. If there are several possible answers, print any.
Sample 1 Input
9 10
1 2 3 4 5 4 3 2 1
Sample 1 Output
3 3
Sample 2 Input
5 6
3 1 1 1 4
Sample 2 Output
5 2
Sample 3 Input
3 100
10 10 10
Sample 3 Output
1 10
HINT
问题来源:CF。