#include<stdio.h>
#include<string.h>
#include<math.h>
#include <stdlib.h>
#include<ctype.h>

//qsort
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

//比較
int max(int a, int b){
	if (a>b) return a;
	else return b;
}

int min(int a,int b) {
	if(a>b) return b;
	else return a;
}


//main関数
int main() {
	long long N,K;
	scanf("%lld %lld",&N,&K);
	
	long long A[N];
	for( long long i=0; i<N; i++ ) {
		scanf("%lld",&A[i]);
		A[i] = A[i] -1;
	}
	
	long long array[N];
	for( long long i=0; i<N; i++ ) {
		array[i] = -1;
	}
	
	long long memory = 0;
	long long sakoda = 0, amari = 0;
	
	for( long long i=0; i<N; i++ ) {
		if (array[memory] != -1) {
			sakoda = i - array[memory];
			amari = array[memory];
			break;
		}
		array[memory] = i;
		memory = A[memory];
	}
	
	for( long long i=0; i<N; i++) {
		array[i] = array[i] - amari;
	}
	
	K = K - amari;
	K = K%sakoda;
	
	for(long long i=0;i<N;i++){
		if( array[i] == K ) {
			printf("%lld",i+1);
			return 0;
		}
	}
}