#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]);
	int current_town = 1;
  p[0] = 1;
	int count = 0, period = 0, base;
	while(count < N){
		count++;
		current_town = A[current_town];
		p[count] = current_town;
		for(int i = 0; i < count; i++)
			if(current_town == p[i]){
				count = N;
				base = p[i];
				period = count - i;
				break;
			}
	}
	current_town = base;
	for(int i = 1; i <= (K-count+1) % period; i++)
		current_town = A[current_town];
	printf("%d", current_town);
	return 0;
}