#include <stdio.h>
int main(void){
    long long int c = 0, i, n, a[200000], b[200000] = {0}, d[200000], e = 0, k, num, count = 0;
    
    scanf("%lld %lld", &n, &k);
    
    for( i = 0; i < n; i++ ){
        scanf("%lld", &a[i]);
    }
    
    for( i = 1; i != 0; i++ ){
        b[c] += 1;
        
        k--;
        if( k <= 0 ){
            printf("%lld", a[c]);
            return 0;
        }
        
        
        
        if( b[c] == 2 ){
            d[e] = a[c];
            e++;
            count++;
        }
        
        if( b[c] == 3 ){
            k++;

            break;
            
        }
        c = a[c] - 1;
        

    }
    
    num = ( k +1) % count;
    
    printf("%lld\n", d[num]);
        
    return 0;
}