#include <stdio.h>

int main(){
	long N, K, A[200001], i, j=0, Now = 1, loopS[200001], loopLen=0;

	scanf("%ld %ld", &N, &K);

	for(i=0; i<N; i++){
		scanf("%ld", &A[i]);//A[i] == A_i-1
	}

	for(i=0; i<K; i++){
		loopS[i] = Now;
		Now = A[Now-1];

		for(j=0; j<i; j++){
			if(loopS[j] == Now){
				loopLen = i-j+1;
				break;
			}
		}

		//printf("j = %ld\n", j);
		//printf("loopS[j] = %ld\n", loopS[j]);

		if(loopLen!=0){
			i = (K-j) % loopLen + j;
			//printf("i = %ld\n", i);
			Now = loopS[i];
			i = K;
		}

		//printf("i = %ld, Now = %ld\n", i, Now);
	}

	printf("%ld", Now);

	return 0;
}
