#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
int main()
{
	long long int n, k, a[200020],i,j=0,star,b[200020],h,c=0;
	scanf("%lld%lld", &n, &k);
	for (i = 1; i <= n; i++)
	{
		scanf("%lld", &a[i]);
	}
	star = 1;
	for (i = 0; i < n; i++)
	{
		b[j++] = star;
		star = a[star];
		for (h = 0; h < j; h++)
		{
			if (star == b[h])
			{
				c = 1;
				break;
			}
		}
		if (c == 1)
		{
			c = j - h;
			break;
		}
	}
	k = (k - h) % c;
	for (i = 0; i < k; i++)
	{
		star = a[star];
	}
	printf("%lld", star);
	return 0;
}