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

typedef long long int64;
typedef unsigned long long uint64;


int main() 
{
	uint64 k;
	uint64 n;
	scanf("%lld %lld", &n, &k);
	uint64* a = (uint64*)malloc(sizeof(uint64) * n);
	for (int i = 0; i != n; i++) 
	{
		scanf("%lld", &a[i]);
	}

	uint64 b = ((k % n) + 1);
	uint64 c = 01;

	for (uint64 i = 0; i != b; i++) 
	{
		c = a[c];
	}
	printf("%lld", c);

	return 0;
}