#include <stdio.h>

int main()
{
    int n;
    long long int k;
    int length, temp, i = 1;
    int Ai[200000] = {0};
    scanf("%d %d\n", &n, &k);
    for (i = 1; i <= 200000; i++)
    {
        scanf("%d", &Ai[i]);
        if (getchar() == '\n')
        {
            break;
        }
    }
    temp = 1;
    for (i = 1; i <= k; i++)
    {
        temp = Ai[temp];
    }
    printf("%d", temp);

    return 0;
}