#include <stdio.h>
#include<string.h>
int main()
{
    int n,flag=1,dest=1,len;
    long long int k,x;
    scanf("%d %lld",&n,&k);
    int a[n],town[2000005],count=1,b[n];x=k;
    memset(b,-1,sizeof b);
    for(int i=0;i<n;i++)
    scanf("%d",&a[i]);
    town[0]=1;
    b[0]=count;
    while(flag&x>-1)
    {
        dest=a[dest-1];
        count++;
        town[count-1]=dest;
        if(b[dest-1]==-1)
        b[dest-1]=count;
        else
        {
            len=(count-b[dest-1]);
            flag=0;
        }
        x--;
    }
    k=k-(count-len-1);
    long long int r=k%len;
    if(x==-1)
    printf("%d",dest);
    else if(x!=-1)
    {
        if(r==0)
        printf("%d",town[count-len-1]);
        else
        printf("%d",town[count-len-1+r]);
    }
}
