from collections import defaultdict

def main():

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

    a = list([int(i)-1 for i in input().split(" ")])

    s = [0]

    d = defaultdict(lambda:0)

    x = a[0]

    for i in range(n):

        s.append(x)

        x = a[x]



    bb=None

    for i in range(n):

        d[s[i]] += 1

        if d[s[i]] ==2:

            bb=s[i]

            break



    cc = s.index(bb)

    s[cc]=-1

    dd = s.index(bb)

    loop_len = dd-cc

    s[cc]=s[dd]

        

    if bb ==None or k < cc:

        print((s[k]+1))

    else:

        y = (k-cc) % loop_len

        print((s[y+cc]+1))



if __name__ == "__main__":

    main()
from collections import defaultdict

def main():

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

    a = list(map(int, input().split(" ")))

    s = []

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

    u = 1

    while ord[u] == -1:

        ord[u] = len(s)

        s.append(u)

        u = a[u-1]

    l = len(s) - ord[u]

    if k < ord[u]:

        print((s[k]))

    else:

        print((s[(k-ord[u])%l+ord[u]]))



'''

def main():

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

    a = list(map(lambda i: int(i)-1, input().split(" ")))

    s = [0]

    d = defaultdict(lambda:0)

    x = a[0]

    for i in range(n):

        s.append(x)

        x = a[x]



    bb=None

    for i in range(n):

        d[s[i]] += 1

        if d[s[i]] ==2:

            bb=s[i]

            break



    cc = s.index(bb)

    s[cc]=-1

    dd = s.index(bb)

    loop_len = dd-cc

    s[cc]=s[dd]

        

    if bb ==None or k < cc:

        print(s[k]+1)

    else:

        y = (k-cc) % loop_len

        print(s[y+cc]+1)

'''

if __name__ == "__main__":

    main()
from collections import defaultdict


def main():
    n, k = list(map(int, input().split(" ")))
    a = list([int(i) - 1 for i in input().split(" ")])
    s = [0]
    d = defaultdict(lambda: 0)
    x = a[0]
    for i in range(n):
        s.append(x)
        x = a[x]
    bb = None
    for i in range(n):
        d[s[i]] += 1
        if d[s[i]] == 2:
            bb = s[i]
            break
    cc = s.index(bb)
    s[cc] = -1
    dd = s.index(bb)
    loop_len = dd - cc
    s[cc] = s[dd]
    if bb == None or k < cc:
        print((s[k] + 1))
    else:
        y = (k - cc) % loop_len
        print((s[y + cc] + 1))


if __name__ == "__main__":
    main()

from collections import defaultdict


def main():
    n, k = list(map(int, input().split(" ")))
    a = list(map(int, input().split(" ")))
    s = []
    ord = [-1] * (n + 1)
    u = 1
    while ord[u] == -1:
        ord[u] = len(s)
        s.append(u)
        u = a[u - 1]
    l = len(s) - ord[u]
    if k < ord[u]:
        print((s[k]))
    else:
        print((s[(k - ord[u]) % l + ord[u]]))


"""
def main():
    n, k = map(int, input().split(" "))
    a = list(map(lambda i: int(i)-1, input().split(" ")))
    s = [0]
    d = defaultdict(lambda:0)
    x = a[0]
    for i in range(n):
        s.append(x)
        x = a[x]
    bb=None
    for i in range(n):
        d[s[i]] += 1
        if d[s[i]] ==2:
            bb=s[i]
            break
    cc = s.index(bb)
    s[cc]=-1
    dd = s.index(bb)
    loop_len = dd-cc
    s[cc]=s[dd]
    if bb ==None or k < cc:
        print(s[k]+1)
    else:
        y = (k-cc) % loop_len
        print(s[y+cc]+1)
"""
if __name__ == "__main__":
    main()

-    a = list([int(i) - 1 for i in input().split(" ")]) +    a = list(map(int, input().split(" "))) +    s = [] +    ord = [-1] * (n + 1) +    u = 1 +    while ord[u] == -1: +        ord[u] = len(s) +        s.append(u) +        u = a[u - 1] +    l = len(s) - ord[u] +    if k < ord[u]: +        print((s[k])) +    else: +        print((s[(k - ord[u]) % l + ord[u]])) + + +""" +def main(): +    n, k = map(int, input().split(" ")) +    a = list(map(lambda i: int(i)-1, input().split(" "))) -    d = defaultdict(lambda: 0) +    d = defaultdict(lambda:0) -    bb = None +    bb=None -        if d[s[i]] == 2: -            bb = s[i] +        if d[s[i]] ==2: +            bb=s[i] -    s[cc] = -1 +    s[cc]=-1 -    loop_len = dd - cc -    s[cc] = s[dd] -    if bb == None or k < cc: -        print((s[k] + 1)) +    loop_len = dd-cc +    s[cc]=s[dd] +    if bb ==None or k < cc: +        print(s[k]+1) -        y = (k - cc) % loop_len -        print((s[y + cc] + 1)) - - +        y = (k-cc) % loop_len +        print(s[y+cc]+1) +"""