#include<stdio.h>
int main()
{
    int n;
    long long int k;
    scanf("%d %lld",&n,&k);
    int a[n+1];
    for(int i=1;i<n+1;i++)
    {
        scanf("%d",&a[i]);
    }
    int count=0;
    int i=1;
    while(1)
    {
        count++;
        i=a[i];
        if(count==k)
        break;
    }
    printf("%d",i);
    return 0;
}
   