#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
#define rep(i,n)Rep(i,0,n)
typedef long long ll;
typedef long double ld;
#define Ma(x,y) ((x)>(y)?(x):(y))
#define mi(x,y) ((x)<(y)?(x):(y))
#define N 200010

int main() {
	int n, a[N], b[N] = { 0 }, c[N] = { 0 }; ll k;
	scanf("%d %lld", &n, &k);
	Rep(i, 1, n + 1)scanf("%d", &a[i]);
	int ch = 1, start, end; b[0] = 1;//行ってみる,startはループ開始,endはループ2週目の最初の何番目か
	Rep(i, 1, N) {
		if (b[ch]!=0){ start = b[ch]; end = i; break; }
		b[ch] += i;
		ch = a[ch];
	}
	c[0]=ch;
	Rep(i,1,end - start+1) {
		c[i] = a[ch];
		ch = a[ch];
	}
	if (k <= start) {
		ch = 1; int K = k;
		rep(i,K) {
			ch = a[ch];
		}
		printf("%d",ch);
	}
	else if(end-start==1){
		printf("%d", a[start]);
	}
	else{
		k -= start-1;
		k %= (end - start);
		printf("%d", c[k]);
	}
}