#include<stdio.h>
int n; long long int k;
int a[200000] = { 0 };
int result = 0;
int b = 0;
int i = 0;

int loopppp() {
	i++;
	if (i < k) {
		result = a[loopppp()];
	}
	else {
		return a[1];
	}
}
int main() {

	

	scanf("%d %lld", &n, &k);
	for (int i = 1; i <= n; i++) {
		scanf("%d", &(a[i]));
	}

	result = a[1];

	loopppp();


	printf("%d\n", result);

	return 0;
}
