#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
typedef long long ll;

int main()
{
    ll n,k,t=0;
    scanf("%lld %lld",&n,&k);
    int a[n],b[n];

    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        b[i]=-1;
    }

    if(a[0]==1)
    {
        printf("1\n");
    }
    else
    {
        int count=1;
        t=a[0];
        while(b[t-1]==-1)
        {
            b[t-1]=count;
            t=a[t-1];
            count=count+1;
        }
        k=k-count;
        count=count-b[t-1];
        k=k%count;

        for(int i=0;i<k;i++)
        {
            t=a[t-1];
        }
    }

    printf("%lld\n",t);

    return 0;
}