For this Question: Given an array Arr with N distinct integers from 1 to N. If you are currently at index i then in a single jump you move to the index Arr[i]. You start at standing at index 1. Find the index you will be after K jumps.First line of input contains two integers N and K.
Second line of input contains N integers, denoting Arr.

Constraints:
1 <= N <= 100000
1 <= K <= 1000000000000
1 <= Arr[i] <= NPrint the index you will be on after K jumps.Sample Input 1
5 3
3 4 2 5 1

Sample Output 1
4

Explanation: 
You start at index 1

After first jump you reach index 3
 
After second jump you reach index 2
 
After third jump you reach index 4, I have written this Solution Code: n,k = map(int,input().split())

arr = list(map(int,input().split()))

visitedElements = {}
i = 0
curr = 0
for i in range(k):
	currentIndex = arr[curr]
	visitedElements[currentIndex] = visitedElements.get(currentIndex,0)+1
	if visitedElements[currentIndex]>1:
		break
	curr = currentIndex -1

print(list(visitedElements.keys())[(k-1)%len(list(visitedElements.keys()))])




, In this Programming Language: Python, Now tell me if this Code is compilable or not?