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

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