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

typedef unsigned long long int ULLI;

void input(int*,int );
int check(int*, int,int );
int search(int*, int ,int );

int main()
{
	int* log;
	int flag = 0;
	int i;
	int* data;
	ULLI n, m;
	int next=0;
	int r;

	scanf("%llu %llu", &n, &m);
	data = (int*)malloc(n * sizeof(int));
	log = (int*)malloc(n * sizeof(int));

	log[0] = 0;
	input(data, n);

	for (i = 0; i < m; i++) {
		next = data[next];
		log[i + 1] = next;
		if ((r=check(log,i,next))!=-1) {
			flag = 1;
			break;
		}
	}
	if (flag == 1) {
		i = search(log, i, log[r]);
		m %= i;
		next = 0;
		for (int j = 0; j < m; j++)
			next = data[next];
	}

	printf("%d\n", data[next]+1);

	return 0;
}

int check(int* log, int i,int next)
{
	int r = -1;

	for (int o = 0; o < i; o++) {
		if (log[o] == next) {
			r = o;
			break;
		}
	}

	return r;
}

void input(int* data,int n)
{
	for (int i = 0; i < n; i++) {
		scanf("%d", &data[i]);
		data[i]--;
	}
}

int search(int* log, int i,int r)
{
	int min;

	for (int o = 0; o < i; o++) {
		if (log[o] == r) {
			min = o;
			break;
		}
	}

	return (i-min);
}