#include <stdio.h>
#include <stdlib.h>
int main(void){
	long n;
	long k;
	long *a;
	long *visited;
	long *x;
	scanf("%ld", &n);
	scanf("%ld", &k);
	a = (long *)malloc(sizeof(long) * n);
	visited = (long *)malloc(sizeof(long) * n);
	x = (long *)malloc(sizeof(long) * n);
	for(long i=0; i<n; i++){
		scanf("%ld", &a[i]);
		visited[i] = 0;
		x[i] = 0;
	}
	long tmp_city = 1;
	long j = 0;
	while(visited[tmp_city-1] == 0){
		visited[tmp_city-1] = 1;
		x[j] = tmp_city;
		j++;
		tmp_city = a[tmp_city-1];
	}
	
	long l = 0;
	while(x[l] != tmp_city){
		l++;
	}

	k = (k-l)%(j-l);
	printf("%ld\n", x[l+k]);
	return 0;
}