N,A=map(int,input().split()) K=input() K=int(K) arr = list(map(int,input().split())) defsolve(A, now, k): vis = [0] * N id = 1 while k > 0: if vis[now] > 0: cycle = id - vis[now] if cycle == 0: return now + 1 k %= cycle if(k == 0): return now + 1 else: vis[now] = id id = id + 1 now = A[now] - 1 k -= 1 return now + 1