#include<stdio.h>

void rr_scanl(int index, int *numBox) {
	char str;
	for (int i = 0; i<index; i++)
		numBox[i] = 0;
	int cnt = 0;
	while (cnt < index) {
		str = getchar();
		if (str == '\n') {
			if (cnt != 0)
				break;
		}
		else if (str < '0' || str > '9')
			cnt++;
		else
			numBox[cnt] = numBox[cnt] * 10 + (int)str - (int)'0';
	}
}

int main() {
	int city = 0;
	unsigned long long teleport;
	unsigned int target[2][200000];
	unsigned int cursor = 1;

	scanf("%d %llu", &city, &teleport);
	rr_scanl(city, target[0]);
	printf("%llu", teleport);

	for (int i = 0; i < city; i++)
		target[1][i] = 0;

	unsigned int loopOut = 0;

	for (unsigned long long i = 0; i < teleport; i++) {
		cursor = target[0][cursor - 1];
		if (target[1][cursor] != 0) {
			loopOut = (unsigned int)((teleport - target[1][cursor]) % ((unsigned int)i - target[1][cursor]));
			for (unsigned int j = 0; j < loopOut; j++)
				cursor = target[0][cursor - 1];
			break;
		}
		else {
			target[1][cursor] = (unsigned int)i;
		}
	}

	printf("%d", cursor);

	return 0;
}