#include<stdio.h>
#include<stdlib.h>

int main(){
	long int N;
	int *p;
	long long int K;
	scanf("%ld %lld", &N, &K);
	p = (int *) malloc(sizeof(int) * (N + 1));	
	int A[N+1];
	for(int i = 1; i <= N; i++){
		scanf("%d", &A[i]);
		p[i] = -1;
	}
	int current_town = 1;
    p[1] = 0;
	int count = 0, period = 0;
	while(count <= N){
		current_town = A[current_town];
		count++;
		if(p[current_town] == -1){
			p[current_town] = count;
		}
		else{
			period = count - p[current_town];
			count = N + 1;
			break;
		}
	}
	K = (K - p[current_town]) % period;
	for(int i = 1; i <= K; i++)
		current_town = A[current_town];
	printf("%d", current_town);
	return 0;
}