#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;
const int maxn=2e5+10;
int n,a[maxn],f[62][maxn];
long long k;
int main()
{
	scanf("%d%lld",&n,&k);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]),f[0][i]=a[i];
	for (int j=1;j<=61;j++)
	 for (int i=1;i<=n;i++) f[j][i]=f[j-1][f[j-1][i]];
	int lc=1;
	for (int i=61;i>=0;i--) if ((k>>i)&1) lc=f[i][lc];
	printf("%d\n",lc);
return 0;
}