#include<stdio.h>

int main() {
	int n;long long int k;
	int a[200000] = {0};
	int result=0;
	int b=0;
	

	scanf("%d %lld", &n, &k);
	for (int i = 1; i <= n; i++) {
		scanf("%d", &(a[i]));
	}

	for (long long int i = 1; i <= k; i++) {
		if (i == 1) {
			result = a[i];
		}
		else {
			b = a[result];
			result = b;
		}
	}



	printf("%d\n", result);

	return 0;
}