import sys

from io import StringIO

import unittest



sys.setrecursionlimit(10**5*2)



def search(u, n, g, disc, k):

    if disc[u] != None:

        circles = n - disc[u]

        v = (k - disc[u]) % circles

        ans = u

        if n > k:

            ans = 0

            for _ in range(k):

                ans = g[ans]

            return ans + 1

        for i in range(v):

            ans = g[ans]

        return ans + 1

    disc[u] = n

    return search(g[u], n+1, g, disc, k)



def resolve():

    n, k = list(map(int, input().split()))

    g = list([int(x) - 1 for x in input().split()])

    disc = [None]*n

    v = search(0, 0, g, disc, k)

    print(v)

resolve()
def resolve():

    n, k = list(map(int, input().split()))

    g = list(map(int, input().split()))

    disc = [-1]*(n+1)

    s = []

    v = 1

    c = 0

    while disc[v] == -1:

        disc[v] = len(s)

        s.append(v)

        v = g[v-1]

        c = len(s) - disc[v]

    l = len(s)

    if l > k:

        print((s[k]))

    else:

        r = (k - disc[v]) % c

        for i in range(r):

            v = g[v-1]

        print(v)

resolve()
import sys
from io import StringIO
import unittest

sys.setrecursionlimit(10**5 * 2)


def search(u, n, g, disc, k):
    if disc[u] != None:
        circles = n - disc[u]
        v = (k - disc[u]) % circles
        ans = u
        if n > k:
            ans = 0
            for _ in range(k):
                ans = g[ans]
            return ans + 1
        for i in range(v):
            ans = g[ans]
        return ans + 1
    disc[u] = n
    return search(g[u], n + 1, g, disc, k)


def resolve():
    n, k = list(map(int, input().split()))
    g = list([int(x) - 1 for x in input().split()])
    disc = [None] * n
    v = search(0, 0, g, disc, k)
    print(v)


resolve()

def resolve():
    n, k = list(map(int, input().split()))
    g = list(map(int, input().split()))
    disc = [-1] * (n + 1)
    s = []
    v = 1
    c = 0
    while disc[v] == -1:
        disc[v] = len(s)
        s.append(v)
        v = g[v - 1]
        c = len(s) - disc[v]
    l = len(s)
    if l > k:
        print((s[k]))
    else:
        r = (k - disc[v]) % c
        for i in range(r):
            v = g[v - 1]
        print(v)


resolve()

-import sys -from io import StringIO -import unittest - -sys.setrecursionlimit(10**5 * 2) - - -def search(u, n, g, disc, k): -    if disc[u] != None: -        circles = n - disc[u] -        v = (k - disc[u]) % circles -        ans = u -        if n > k: -            ans = 0 -            for _ in range(k): -                ans = g[ans] -            return ans + 1 -        for i in range(v): -            ans = g[ans] -        return ans + 1 -    disc[u] = n -    return search(g[u], n + 1, g, disc, k) - - -    g = list([int(x) - 1 for x in input().split()]) -    disc = [None] * n -    v = search(0, 0, g, disc, k) -    print(v) +    g = list(map(int, input().split())) +    disc = [-1] * (n + 1) +    s = [] +    v = 1 +    c = 0 +    while disc[v] == -1: +        disc[v] = len(s) +        s.append(v) +        v = g[v - 1] +        c = len(s) - disc[v] +    l = len(s) +    if l > k: +        print((s[k])) +    else: +        r = (k - disc[v]) % c +        for i in range(r): +            v = g[v - 1] +        print(v)