#include<stdio.h>
#define ll long long
int main()
{
    11 N,K;11 i;
    scanf("%d %d",&N,&K);
    ll town[200005];
    for(i=1;i<=N;i++)
        scanf("%d",&town[i]);
    ll flag[200005];
    for(i=1;i<=N;i++)
        flag[i]=0;

    /**************************************************寻找第一个出现循环的镇****************************************************/
    flag[1]=1;ll now=1;
    for(i=1;i<=K;i++)
    {
        if(flag[town[now]]==1)    //到达第一个重复的镇，走了i步；
            break;
        flag[town[now]]=1;        
        now=town[now];
    }
    ll SpTown=town[now];          
    ll pre_sum=i;    

    i=0;now=1;
    while(now!=SpTown)
    {
        now=town[now];
        i++;
    }
   ll pre=i;ll y;
    y=pre_sum-pre;

    now=1;
    if(K<=pre)
         while(K--)
            now=town[now];
    else
    {
        K-=pre;
        K%=y;
        now=SpTown;
        while(K--)
            now=town[now];
    }


    printf("%d",now);
    return 0;
}
