#include<stdio.h>
int main()
{
    int N,K;
    scanf("%d %d",&N,&K);
    int town[200000];
    for(int i=1;i<=N;i++)
        scanf("%d",&town[i]);
    int now=1;
    while(K--)
        now=town[now];
    printf("%d",now);


    return 0;
}
