Bobo recently visited a strange teleportation system. The system contains $$$n$$$ rooms, numbered $$$0$$$ through $$$n-1$$$. A teleporting device is installed in each room. Each teleporting device contains a dashboard that looks like a clock surface with a hand on it, showing numbers $$$0$$$ through $$$n-1$$$ in clockwise order. Initially, the hand on the dashboard of the teleport device in the $$$i$$$-th $$$(0\leq i\leq n-1)$$$ room points to the number $$$a_i$$$.
When Bobo is in room $$$i$$$ $$$(0\leq i\leq n-1)$$$, he may do the following operation any number of times:
Each operation takes one unit of time. Bobo starts at room $$$0$$$, and he wants to reach some room $$$x$$$ as quickly as possible. He wonders how long it is needed.
The first line of input contains two integers $$$n$$$ $$$(2\leq n\leq 10^5)$$$ and $$$x$$$ $$$(1\leq x\leq n-1)$$$, denoting the number of rooms and Bobo's destination room, respectively.
The next line contains $$$n$$$ integers $$$a_0,a_1,\dots,a_{n-1}$$$ $$$(0\leq a_i\leq n-1)$$$, where $$$a_i$$$ $$$(0\leq i\leq n-1)$$$ denotes the number the hand in the $$$i$$$-th room points to.
Output an integer in a line, denoting the minimum time Bobo needs to reach room $$$x$$$ from room $$$0$$$.
4 30 1 2 3
4
4 30 0 0 0
4
4 32 2 2 2
2
Here, we provide graphical illustrations of one possible optimal way in the first sample. Initially, Bobo is at room $$$0$$$, and the hand on each dashboard is at $$$0,1,2,3$$$, respectively.
The first operation Bobo does is to move the hand clockwise so that the hand on the dashboard in room $$$0$$$ points to $$$1$$$. $$$(a_0=1)$$$
Then Bobo teleports to room $$$(0+a_0)\bmod n=1$$$.
After that, Bobo moves the hand clockwise so that the hand on the dashboard in room $$$1$$$ points to $$$2$$$. $$$(a_1=2)$$$.
Then Bobo teleports to room $$$(1+a_1)\bmod n=3$$$, reaching his desired destination. It takes an overall of $$$4$$$ operations.