PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#BS0000149. Danh sách phát lặp vòng (Circular Playlist)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Danh sách phát lặp vòng (Circular Playlist)

Circular Playlist

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

A playlist consists of NN songs numbered 11 through NN. Song ii lasts AiA_i seconds. Songs play in order, and immediately after song NN finishes the playlist starts again at song 11. There is no pause between songs.

At exactly TT seconds after playback begins, determine the playing song and the time elapsed since its start. It is guaranteed that TT is not a song transition time.

Input

  • The first line contains NN and the time TT in seconds.
  • The second line contains NN integers A1,…,ANA_1,\ldots,A_N in playback order.

Output

Print the 11-based song number followed by the elapsed seconds within that song.

Subtasks

  • Subtask 1 (20 points): 1≤N≤1001\le N\le100; 1≤T≤1061\le T\le10^6; 1≤Ai≤1031\le A_i\le10^3 for all ii; TT is not a song transition time.
  • Subtask 2 (30 points): 1≤N≤1041\le N\le10^4; 1≤T≤10121\le T\le10^{12}; 1≤Ai≤1061\le A_i\le10^6 for all ii; TT is not a song transition time.
  • Subtask 3 (50 points): 1≤N≤1051\le N\le10^5; 1≤T≤10181\le T\le10^{18}; 1≤Ai≤1091\le A_i\le10^9 for all ii; TT is not a song transition time.

Examples

Input

3 600
180 240 120

Output

1 60

Explanation

One complete cycle lasts 180+240+120=540180+240+120=540 seconds. At T=600T=600, exactly one cycle has ended and 600−540=60600-540=60 seconds have passed in the next cycle. Song 11 lasts 180180 seconds, so song 11 is playing with 6060 seconds elapsed; print 1 60.