时间限制:C/C++/Rust/Pascal 3秒,其他语言6秒
            空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
             64bit IO Format: %lld
        
     
    题目描述
        
        
    
            
              There are 

 children playing with 

 balls. Both children and balls are numbered from 

 to 

. 
   
   Before the game, 

 integers 

 are given. In each round of the game, child 

 will pass the ball he possesses to child 

. It is guaranteed that no child will pass his ball to himself, which means 

. Moreover, we also know that after each round, each child will hold exactly one ball. 
   
   Let 

 be the ball possessed by child 

. At the beginning of the game, child 

 (

) will be carrying ball 

, which means 

 initially. You're asked to process 

 queries. For each query you're given an integer 

 and you need to compute the value of 

 after 

 rounds. 
 
                            输入描述:
                                                    There is only one test case for each test file.
The first line of the input contains two integers 

 (

) and 

 (

), indicating the number of children and the number of queries.
The second line contains 

 integers 

 (

) indicating how the children pass the balls around.
For the following 

 lines, the 

-th line contains one integer 

 (

) indicating a query asking for the result after 

 rounds.
                                                                            输出描述:
                                                    For each query output one line containing one integer indicating the answer.
                                                                            
                                                        备注:
                The sample test case is explained below.