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


    flag[1]=1;
    for(i=1;i<=K;i++)
    {
        if(flag[town[i]]==1)
            break;
        flag[town[i]]=1;

    }
    int SpTown=town[i];


    int now=1;i=1;
    while(town[now]!=SpTown)
    {
        now=town[now];
        i++;
    }
    int first=i;int y;
    for(y=1;town[town[now]]!=SpTown;y++)

    K=K-first;now=1;
    while(first--)
        now=town[now];
    K=K%y;now=town[now];
    while(K--)
        now=town[now];

    printf("%d",now);

    return 0;
}
