#include <stdio.h>
int main(void)
{
    int i=0,j=0,s=1,N,K,a[200000];
    scanf("%d%d",&N,&K);
    while(i<=N){
        scanf("%d",&a[i]);
    }
    while(j<=K){
        s==a[s];
    }
    printf("%d\n",s);
    return 0;
}
