Скоро Codeforces Round 1133 (Div. 1, Div. 2)! Регистрация здесь. ×
A. Skipping Songs
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
Daisy the Great & AJR

Noah loves music and has various albums stored on discs. However, whenever he listens to his albums, he is very picky about the songs and skips around a lot. The disc always starts on the first song and rotates in order of the album. Once it gets past the end, it restarts from the beginning. Given how many songs Noah skips before listening to each song, print the list of songs in the order he listened to them.

Note: Whenever he decides on a song, he listens to it in its entirety before counting his skips to the next song.

Input

The first line will contain two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 10^5$$$) — the number of songs in the album and number of songs he listened to.

The next $$$n$$$ lines each contain the name of a song in the order of the album. Each name is guaranteed to be no more than 100 characters.

The last $$$m$$$ lines each contain a single integer $$$s_i$$$ ($$$1 \leq s_i \leq 10^9$$$) — the number of songs Noah skipped before listening to the $$$i$$$th song.

Output

The output should contain $$$m$$$ lines each containing the name of a single song in the order Noah listened to them.

Example
Input
12 7
Maybe Man
Touchy Feely Fool
Yes I'm A Mess
The Dumb Song
Inertia
Turning Out Pt. iii
Hole in the Bottom of My Brain
The DJ is Crying for Help
I Won't
Steve's Going to London
God is Really Real
2085
3
5
2
4
6
13
1
Output
The Dumb Song
Steve's Going to London
Maybe Man
Turning Out Pt. iii
Maybe Man
Yes I'm A Mess
Inertia