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

int main() {
	int n, b,i;
	long long k;
	scanf("%d %lld\n", &n, &k);
	int a[200000],c[200000],count[200000];
	for (i = 0; i < n; i++) {
		scanf("%d", &a[i]);
        count[i]=0;
	}
	b = 1;
	for (i = 0; i < n; i++) {
		b = a[b - 1];
		c[i] = b;
		count[b-1]++;
		if (count[b-1] == 2) {
			printf("%d", c[(k % i)-1]);
           return 0;
		}
	}
	printf("%d", c[k - 1]);

	return 0;
}