#include<stdio.h>

int main(void)
{
	long long int a, b, c, n, k;
	long long int A[200000];
	long long int B[200000];
	long long int C[200000];
	long long int i, o;
	

	scanf("%lld%lld", &n, &k);

	for (i = 0; i < n; i++) {
		scanf("%lld", &(A[i]));
		B[i] = -1;
      C[i] = -1;
	}

	i = 0;
	B[0] = 0;
	for( ; ;) {
		if (C[A[B[i]]-1] != -1) {
			break;
		}
		B[i + 1] = A[B[i]] - 1;
		C[B[i + 1]] = 1;
		i++;
	}

	a = (k + 1) % (i + 1);



	printf("%lld", B[a] + 1);

	return 0;
}