#include <stdio.h>
int main(void)
{
    long long int n, k;
    scanf("%lld %lld", &n, &k);
    int flag[20002] = {0};
    int tmp2[n];
   
    long long int c, now;
  long long int i;
    long long int A[n];
    for (i = 1; i <= n; i++)
        scanf("%lld", A + i);
    now = 1;
    long long int q;
    c =0;
    
    while (1){
        if (c == k)
        {
            printf("%lld", now);
            return (0);
        }

    flag[now] = 1;
    tmp2[now] = c++;
    
 
    if (flag[A[now]] == 1)
        break;
    
    now = A[now];
    
    }
    
    
    
    q = c - tmp2[A[now]];
  
  
    q = (k - c + 1)%q;
    while (q > 0)
    {
        now = A[now];
        q--;
    }
    printf("%lld", now);
    return (0);
}