#abc167d. [abc167_d]Teleporter
[abc167_d]Teleporter
Problem Statement
The Kingdom of Takahashi has towns, numbered through .
There is one teleporter in each town. The teleporter in Town sends you to Town .
Takahashi, the king, loves the positive integer . The selfish king wonders what town he will be in if he starts at Town and uses a teleporter exactly times from there.
Help the king by writing a program that answers this question.
Constraints
Input
Input is given from Standard Input in the following format:
Output
Print the integer representing the town the king will be in if he starts at Town and uses a teleporter exactly times from there.
Sample Input 1
4 5
3 2 4 1
Sample Output 1
4
If we start at Town and use the teleporter times, our travel will be as follows: .
Sample Input 2
6 727202214173249351
6 5 2 5 3 2
Sample Output 2
2