#include <stdio.h>
#include <ctype.h>
#include <string.h>


int main() {
	int N;
	int K;
	int a[300000] = { 0 };

	scanf("%d %d", &N, &K);
	int t = 0;
	for (t; t < N; t++) {


		scanf("%d", &a[t]);
	}


	int i;
	int now = 1;
	for (i = 0; i < K; i++) {
		now = a[now-1];
	
	}
	printf("%d", now);
	return 0;
}

