Олимпиадный тренинг

Задача 43351. Tommy's books


Tommy loves to read. He took n books from the library (in the ith book ai pages, pages are numbered with < code>1). Tommy is very careful with books, so he wrapped each of them in a cover. But, since he did not have any transparent covers, he numbered the books from 1 to n and wrote the number on the cover of each book.

Tommy has been reading for m days in a row. He reads books strictly in order, starting with book number 1.  Every day, he writes down on the board the total number of pages he has read so far.

For example, if Tommy took 2 books and, at the same time, there were 3 pages in the first book, and 5 pages in the second, then after reading 2 pages on the first day, and 4 pages on the second day, Tommy had on the board two numbers 2 and 6 would be written.

Tommy took a short break, and when he returned to reading, he realized that he had forgotten which book he was reading and which page he had stopped on. He also does not want to lose statistics, but wants to correct it by adding on what day which book he read and on which page he stopped. Help Tommy, by the numbers written on the board, to determine on what day what book he read and on what page he stopped.


Input
The program receives several lines as input. The first line contains two integers n and m (1 <= n, n <= 2·105) - the number of books Tommy borrowed from the library and the number of days that Tommy read books. The second line contains the sequence a1, a2, ... an (1 <= a1<= 1010), where ai equals the number of pages in the ith book. The third line contains the sequence d1, d2, ... dm (1 <= dj <= a+ a+...+ an), where dj equals the total number of pages read by Tommy by jth day. All dj are in in ascending order.

Output

Output m lines. In each line print two numbers - нbook number k (1 <=  <= n) and page number in this book s (1 <= <= ak) that Tommy settled on for the current day.

 
Examples
# Input Output
1 3 6
10 15 12
1 9 12 13 15 17
1 1
19
2 2
23
25
27
2 2 3
5 10000000000
5 6 9999999999
1 5
2 1
29999999994